I know we can get the last row with data with following code:
LastRow = .Range("D" & .Rows.Count).End(xlUp).Row
But I am having trouble on getting the last Column with data. Here is what i tried bu as you can see from the image it didn't go through
Set ws = ThisWorkbook.ActiveSheet
With ws
Header = 5
LastRow = .Range("D" & .Rows.Count).End(xlUp).Row
LastCol = .Range(5 & .ColumnCount).End(xlLeft).Column
With .Range("A" & Header & LastCol & LastRow)
.Interior.ColorIndex = 16
End With
End With
Can you please let me know hoe I can fix this? thanks
Cells
instead ofRange
. – L42Columns.Count
instead of Column.Count – Tony Dallimore