wiscochris
New Member
- Joined
- Dec 25, 2021
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hi, I found this awesome vba script here on the forum.
It does exacly what I need where it copies columns BV:BX of "1 - all" and combines them into one column on a separate sheet ("stacked") but it dumps the data into column "A".
I would like to be able to select which column the data gets dumped into so that I can run the script for other data sets and put them in the same "stacked" sheet.
I've tried chaning the column reference "A" to somting else but it does not work . I"m not familiar enough with VBA to solve this (I hope) simple issue.
Thanks in advance to anyone who can help me.
It does exacly what I need where it copies columns BV:BX of "1 - all" and combines them into one column on a separate sheet ("stacked") but it dumps the data into column "A".
I would like to be able to select which column the data gets dumped into so that I can run the script for other data sets and put them in the same "stacked" sheet.
I've tried chaning the column reference "A" to somting else but it does not work . I"m not familiar enough with VBA to solve this (I hope) simple issue.
Thanks in advance to anyone who can help me.
VBA Code:
Sub Copy_Columns()
Application.ScreenUpdating = False
Dim i As Long
Dim lastRow As Long
lastRow = Sheets("1 - All").Cells(Rows.Count, "BV").End(xlUp).Row
Dim Lastrowa As Long
With Sheets("stacked")
Lastrowa = .Cells(Rows.Count, "a").End(xlUp).Row + 1
.Cells(Lastrowa, 1).Resize(lastRow).Value = Sheets("1 - All").Cells(2, "BV").Resize(lastRow).Value
Lastrowa = .Cells(Rows.Count, "a").End(xlUp).Row + 1
lastRow = Sheets("1 - All").Cells(Rows.Count, "BW").End(xlUp).Row
.Cells(Lastrowa, 1).Resize(lastRow).Value = Sheets("1 - All").Cells(2, "BW").Resize(lastRow).Value
Lastrowa = .Cells(Rows.Count, "a").End(xlUp).Row + 1
lastRow = Sheets("1 - All").Cells(Rows.Count, "BX").End(xlUp).Row
.Cells(Lastrowa, 1).Resize(lastRow).Value = Sheets("1 - All").Cells(2, "BX").Resize(lastRow).Value
Lastrowa = .Cells(Rows.Count, "a").End(xlUp).Row + 1
lastRow = Sheets("1 - All").Cells(Rows.Count, "BY").End(xlUp).Row
.Cells(Lastrowa, 1).Resize(lastRow).Value = Sheets("1 - All").Cells(2, "BY").Resize(lastRow).Value
End With
Application.ScreenUpdating = True
End Sub