Hello,
I am working on a macro that has 240 columns of data with a value in the first row (A1) that I need to copy and paste in the next column. Thus, I have wrote the vba to go through the worksheet and insert 240 blanks columns.
Now I need to copy the data in the first cell (A1) to the new inserted column (B2:B), throughout the document. The length of each column of data changes, some will be 4 cells in length, others might be 60 cells in column length.
I tried this:
Dim LR As Long
LR = Range("C" & Rows.Count).End(xlUp).Row
Range("C1").AutoFill Destination:=Range("D1:D" & LR)
For m = LR To 2
Next m
However as you can imagine by me posting here, it did not work. Suggestions?
New to VB. Thanks!
Joe
I am working on a macro that has 240 columns of data with a value in the first row (A1) that I need to copy and paste in the next column. Thus, I have wrote the vba to go through the worksheet and insert 240 blanks columns.
Dim j As Integer, k As Integer, m As Integer
j = Range("A1").End(xlToRight).Column
'j is the last column
For k = j To 2 Step -1
Range(Cells(1, k), Cells(1, k)).EntireColumn.Insert
Next k
Now I need to copy the data in the first cell (A1) to the new inserted column (B2:B), throughout the document. The length of each column of data changes, some will be 4 cells in length, others might be 60 cells in column length.
I tried this:
Dim LR As Long
LR = Range("C" & Rows.Count).End(xlUp).Row
Range("C1").AutoFill Destination:=Range("D1:D" & LR)
For m = LR To 2
Next m
However as you can imagine by me posting here, it did not work. Suggestions?
New to VB. Thanks!
Joe