[vba] Grab Numerous Columns & Compile Into One

DataBlake

Well-known Member
Joined
Jan 26, 2015
Messages
781
Office Version
  1. 2016
Platform
  1. Windows
I'm at a loss for how to solve this one.
I need to grab part numbers from column A on specific named sheets within the workbook. Lets say they are sheets named "1" "2" and "3".
When i run the macro i need it to grab everything in column A from these sheets and put them compiled into the A column of sheet "4"

any help would be greatly appreciated.
 
try this
Code:
Sub collet_A()
    Dim Vout As Variant, ct As Long
    Dim SheetNames As Variant
    ReDim Vout(1 To Sheets.Count - 1)
    ReDim Z(1 To Sheets.Count - 1)
   SheetNames = Array("MTH", "WP", "MKK", "TTW", "W1", "RHH")
    For Each sheetname In SheetNames
        lenx = Sheets(sheetname).Cells(Rows.Count, "A").End(xlUp).Row
        len_t = len_t + lenx
        a = Sheets(sheetname).Range("A1:A" & lenx).Value
        ct = ct + 1
        Vout(ct) = Array(a)
        Z(ct) = Application.Transpose(Application.Index(Vout(ct)(0), 0, 0))
    Next
    For i = 1 To UBound(Z)
        Sheets("sheet4").Range("a1:a" & UBound(Z(i))).Offset(x) = Application.Transpose(Z(i))
        x = x + UBound(Z(i))
    Next
End Sub
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,214,819
Messages
6,121,729
Members
449,049
Latest member
MiguekHeka

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