0

I'm trying to select the true last cell data set then insert a subtotal into the cell below. Everything I've tried selects the last cell of my visible data. I need the last cell of the entire sheet.

For instance, my filtered data will have rows 3:10 visible. My code is selecting row 10 when I need it to select the last row of the entire dataset that's hidden (row 100).

This will be performed on multiple sheets at once.

Here's my code:

Sub Example()

Dim LastRow As Long

With ActiveSheet
    LastRow = .Range("J2").SpecialCells(xlCellTypeLastCell).Row

End With

Call SubTotalMacro

End Sub

Thanks!

1 Answers1

0

Try this: MsgBox ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row

Muzaffer Galata
  • 580
  • 1
  • 9
  • 22