shettyrish
01-23-2018, 10:46 PM
Hi, I have a code that copies data from one workbook to another. Now, the 2nd column in my destination workbook has a certain color format that I need to be applied till the last column with data in it.
This is my code snippet to find the last non-empty column :
Dim rLastCell As Range
Set ws = ThisWorkbook.Sheets(DestName)
Set rLastCell = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False)
Dim LastCol As Long
LastCol = rLastCell.Column
MsgBox LastCol
So, now I want to iterate and paste the format from the 2nd column to all the columns until LastCol.
Any help would be appreciated. Thank you
This is my code snippet to find the last non-empty column :
Dim rLastCell As Range
Set ws = ThisWorkbook.Sheets(DestName)
Set rLastCell = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False)
Dim LastCol As Long
LastCol = rLastCell.Column
MsgBox LastCol
So, now I want to iterate and paste the format from the 2nd column to all the columns until LastCol.
Any help would be appreciated. Thank you