last row needs updating

robertvdb

Active Member
Joined
Jan 10, 2021
Messages
334
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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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