Messy excel worksheet needs reorganizing

PhilDesanex

New Member
Joined
Feb 4, 2016
Messages
8
We have inherited a lapsed customer list that we want to use for some marketing to tell them about our new website. The list has been made on an excel sheet but not in a proper worksheet layout. I have five of these worksheets so a manual correction will take me forever. I would like to know if there is an automated way to convert these records into a correct table layout. In my illustration below, Column A contains a customer code. Column B contains an address which lays out down the sheet rather than across into columns C onwards. The address can be 4 or 5 lines but there is always a blank line between the individual customer details. Is there a macro I could use to parse through the worksheet and move the address lines onto the same row as the customer code, as per a normal Excel layout? Any help would be appreciated. Is there some way to detect the combination of a blank cell/non-blank cell in column A that would help to determine when to start the next record?

ABACAbacus Taxis
2, Any Street
Anytown
Any County
Any Postcode
BRAVBravo taxis
14 Another Street
Another County
Another postcode
CITYCity Cabs
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
How about
VBA Code:
Sub PhilDesanex()
   Dim Rng As Range
   
   For Each Rng In Range("B:B").SpecialCells(xlConstants).Areas
      Rng.Resize(1, Rng.Count).Value = Application.Transpose(Rng)
   Next Rng
   Range("A:A").SpecialCells(xlBlanks).EntireRow.Delete
End Sub
 
Upvote 0
Put it into a standard module & when you run it, it will work on the active sheet. After it has run you will get single rows for each customer.
 
Upvote 0
Fluff, that bit of code worked brilliantly. Thanks. I'm posting another problem which is hopefully straightforward.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,018
Messages
6,122,703
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top