Greetings all.
In the process of trying to code a long transaction macro I have a general (and hopefully) simple question to the gallery before I begin.
I have 4 product groups that I will be calculating discounts, one after the other.
Before I do that I have to prep the sheet and find the last row for the whole data and then begin with each product group, pulled from data filter. So my first section, the prep is fine:
Dim lRow As Long
lRow = Cells(Application.Rows.Count, Columns(“B”).Column).End(xlUp).Row
But each group will be identified from the filter row in Column G – and the length will be unknown. If I apply the same coding – ie
Dim lRowA ‘(product A – Last Row)
Selection.AutoFilter Field:=7, Criteria1:=”=A-*”, Operator:=xlAnd
lRowA = Cells(Application.Rows.Count, Columns(“G”).Column).End(xlUp).Row
then onto lRowA, lRowB, lRowC, etc
As the filter will only show visible applicable cells, the original lRow would not be applicable.
So –
Will my value for the original lRow change? As I am still doing calculations before and after these sorts, I would need to keep that lRow value constant.
Or is there an easier way to get last row for the sheet and each of the four variable last rows without changing their respective numbers?