reorganise table

I get this accounts table in a format which is highly inconvenient to work with. It has strings of text which are split into rows instead of wrapping in a cell, numbers which are merged across cells.

Can someone give me a macro to convert this table into a more manageable format with split texts collected together and numbers in the appropriate column and no blank rows or columns so that further working on this file is convenient.
LVL 43
Saqib Husain, SyedEngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Following does it for this file, at least. Be careful, the only intelligence here is whatever Excel brings!

BTW, this was recorded on 2010.
Option Explicit

Sub Tidy_Bank()
Dim xLast_Row As Long

With Cells
    .VerticalAlignment = xlTop
    .WrapText = False
    .Orientation = 0
    .AddIndent = False
    .ShrinkToFit = False
    .MergeCells = False
End With
Columns("I:I").ColumnWidth = 44.56
Columns("I:I").WrapText = True
xLast_Row = Range("A1").SpecialCells(xlLastCell).Row
ActiveSheet.Range("$B$1:$V" & xLast_Row).AutoFilter Field:=1, Criteria1:="="
ActiveSheet.Range("$B$1:$V" & xLast_Row).AutoFilter Field:=8, Criteria1:="="
ActiveSheet.Range("$B$1:$V" & xLast_Row).AutoFilter Field:=9, Criteria1:="="
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Delete Shift:=xlUp
ActiveWindow.FreezePanes = True
Range("Q:S,N:N,M:M,K:K,G:H,E:E,C:C").Delete Shift:=xlToLeft
Range("F2:F4").Cut Destination:=Range("E2:E4")
Columns("F:F").Delete Shift:=xlToLeft
Range("H5:H6").Cut Destination:=Range("I5:I6")
Columns("H:H").Delete Shift:=xlToLeft
Range("D5:D6").Cut Destination:=Range("C5:C6")
Columns("D:D").Delete Shift:=xlToLeft
Range("G5:H6").Cut Destination:=Range("F5:G6")
Range("A:A").Delete Shift:=xlToLeft

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerAuthor Commented:
Thanks. Saved me some time.
Thanks, ssaqibh. Brought back un-fond memories!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.