How to get last row variable to update

LtCmdrData

New Member
Joined
Jan 24, 2018
Messages
43
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,997
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,148,250
Messages
5,745,638
Members
423,965
Latest member
visionquest1972

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
Top