quantmaven
New Member
- Joined
- May 16, 2018
- Messages
- 11
Hi!
I have monthly time series from column A to AU. Every month I need to fill the last row. The code below works for ALL columns. How can I adapt this code so it does the same just from column A to AU? Thanks in advance!
I have monthly time series from column A to AU. Every month I need to fill the last row. The code below works for ALL columns. How can I adapt this code so it does the same just from column A to AU? Thanks in advance!
Code:
Sub Fill_Lastrow_AcrossColumns()
Application.ScreenUpdating = False
Dim Ccol As Long
Dim c As String
Dim Dws As Worksheet
Set Dws = Sheets("DATA")
LastCol = Cells(7, Columns.Count).End(xlToLeft).Column
For Ccol = 2 To LastCol
c = Replace(Split(Columns(Ccol).Address, "$")(1), ":", "")
lrow = Sheets("DATA").Range(c & "65536").End(xlUp).Row
Sheets("DATA").Range(c & lrow).Copy Destination:=Sheets("DATA").Range(c & lrow + 1)
Next
End Sub