Copy to next cell until CAPITAL words

djfreex

New Member
Joined
Aug 8, 2008
Messages
11
COMPANY A
555 FAKE ST
555-555-5555
NEW YORK, NY 5555
Phone: (222) 222-2222
Fax: (222) 222-2222
COMPANY B
555 FAKE ST
555-555-5555
NEW YORK, NY 5555
Phone: (222) 222-2222
Fax: (222) 222-2222

I have data set of addresses like above in a spreadsheet that I want to convert to a address book like format - name,address, phone etc in different columns. Addresses are not always 6 lines - might be 4 or 5.

Whats the most efficient way to get this accomplished? Thanks!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You need something to identify the start or end of a record (preferably both). Does the last line of ea record ALWAYS start w/Fax: ?
 
Upvote 0
Start is always CAPITAL letters and end line is not always fax - some addresses dont have fax, but most do. Thanks.
 
Upvote 0
Maybe something like this,
start with, copy the data to cell A1 in a blank sheet, make sure there is no blank rows. Then run this macro

Code:
Sub b_test()

fr1 = Cells(Rows.Count, 1).End(xlUp).Row
Range("a" & fr1 + 1) = "STOP"

y = 1
x = 1

For i = 2 To fr1 + 1

    If UCase(Range("A" & i)) = Range("A" & i) Then
    Range(Range("A" & y), Range("A" & i - 1)).Copy
    Range("B" & x).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
        y = i
        x = x + 1
     End If
Next

Range("a" & fr1 + 1).ClearContents
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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