How to get last row variable to update

LtCmdrData

Board Regular
Joined
Jan 24, 2018
Messages
58
Office Version
  1. 365
Platform
  1. Windows
I'm still trying to learn VBA so I hope someone can help me please. I have some rows of data that I need to clean up. I set a variable, lr = Cells(Rows.Count, "A").End(xlUp).Row, to determine how many rows are in my data set based on column A. First I want to delete any blank rows and then I want to filter for certain criteria and delete more rows. Since the total number of rows keeps changing, here is my dilemma: How do I get my variable (lr) to update to the new number of rows? My work around has been to declare a new variable, such as lrow, every time my data set changes. I know there must be a better way of doing this but I don't know what I don't know. I would appreciate any help and guidance someone could offer. Thank you.
 
Glad we could help & thanks for the feedback.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top