last row needs updating

robertvdb

Active Member
Joined
Jan 10, 2021
Messages
339
Office Version
  1. 2016
Platform
  1. Windows
I have a range of, say, 10 rows which needs to be looped through.

If a certain condition is met, then a new row needs to be inserted, making the range = 11 rows.

So zRow (the last row) increases from 10 to 11.

However, zRow stays at 10. Any idea how to solve this ?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi, generally speaking, if you are inserting or deleting rows with VBA in a loop then you should start from the bottom and work up.

VBA Code:
For zRow = 10 To 2 Step -1
'do stuff
Next zRow
 
Upvote 0
Solution
Thanks FormR

your advice is very useful, yet it does not solve the issue of the zRow number which has changed. Any further suggestions on this issue ?

Thanks
 
Upvote 0
Hi, you haven't provided enough information for me to comment further.
 
Upvote 0
OK, I think I'm gonna close this post, since your advice to work decrementally solves my issue. Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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