I have this simple macro:
I expect it to return the column number of the rightmost cell with text in the range, but instead it returns the column number of the first cell in the range. What am I doing wrong?![]()
Sub LastColRng() Dim SelRange As Range Set SelRange = Selection Dim LastCol As Long SelRange.Resize(, 261).Select LastCol = SelRange.Find("*", after:=SelRange(1, 1), SearchDirection:=xlPrevious).Column MsgBox LastCol End Sub
Bookmarks