Excel VBA Macro to Find Last Used Row and Column in a Worksheet
Sub LastRow_UsedInSheet()
MyLastRow = ActiveSheet.Cells.Find(what:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
MyLastColumn = ActiveSheet.Cells.Find(what:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
MsgBox MyLastRow & " Rows Have Used In ActiveSheet " & vbCrLf & _
MyLastColumn & " Columns Have Used In ActiveSheet "
End Sub
Sub LastRow_UsedInSheet()
MyLastRow = ActiveSheet.Cells.Find(what:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
MyLastColumn = ActiveSheet.Cells.Find(what:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
MsgBox MyLastRow & " Rows Have Used In ActiveSheet " & vbCrLf & _
MyLastColumn & " Columns Have Used In ActiveSheet "
End Sub
No comments:
Post a Comment
Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.