Formula to concatenate addresses formatted vertically

Arigato123

New Member
Joined
Jan 19, 2022
Messages
4
Office Version
  1. 2021
Platform
  1. Windows
Hi everyone,

I have been given a spreadsheet with just over 20000 lines of data, addresses to be exact. all formatted vertically in different cells e.g.

mini sheet 1.xlsx
A
1Customer 1
2Address 1
3Address 2
4Address 3
5Address 4
6Address 5
7Tel
8Web
9Customer 2
10Address 1
11Address 2
12Address 3
13Address 4
14Address 5
15Tel
16Web
17Customer 3
18Address 1
19Address 2
20Address 3
21Address 4
22Address 5
23Tel
24Web
Sheet1


As you can see above (I have removed the data and replaced with just dummy data) they are all formatted vertically, is there a way to fix this so that they all run across the rows instead of down the numbered rows?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi
Do you mean some thing like this?
VBA Code:
Sub test2()
    Dim A, B
    Dim I As Long
    Dim II As Long
    Dim K As Long
    Dim c
    c = 1
    With Sheets("sheet1")
        A = .Cells(1, 1).Resize(Cells(Rows.Count, 1).End(xlUp).Row)
        ReDim B(1 To UBound(A) / 8, 1 To 8)
        For I = 1 To UBound(A) Step 8
            For II = 1 To 8
                B(c, II) = A(K + II, 1)
            Next
            c = c + 1
            K = K + 8
        Next
        .Cells(3, 3).Resize(UBound(B), UBound(B, 2)) = B
    End With
End Sub
 
Upvote 0
Hi
Do you mean some thing like this?
VBA Code:
Sub test2()
    Dim A, B
    Dim I As Long
    Dim II As Long
    Dim K As Long
    Dim c
    c = 1
    With Sheets("sheet1")
        A = .Cells(1, 1).Resize(Cells(Rows.Count, 1).End(xlUp).Row)
        ReDim B(1 To UBound(A) / 8, 1 To 8)
        For I = 1 To UBound(A) Step 8
            For II = 1 To 8
                B(c, II) = A(K + II, 1)
            Next
            c = c + 1
            K = K + 8
        Next
        .Cells(3, 3).Resize(UBound(B), UBound(B, 2)) = B
    End With
End Sub

Yes thanks, it has worked. However there is one problem. Some of the addresses, web and telephone details are 7 lines and some are 8 which makes the data run out of sync. Is there a way to get the VBA to account for that?
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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