Why does the code stop where it stops?

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
This seems too basic, but I don't understand.

Code:
2Import_3Formula r, "H", "=abs(RC6-RC7)"

My sheet has 32 rows, including a header. Rows 33 onward are blank. Except Column H, which has a value of 0 in rows 33-55. How can I stop it at the last row? There could sometimes be 2-300 rows. Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Pick a column that will always have data in it for any populated row. Then use that to dynamically find where the last row is.
So, let's say that it is column "C". Then we can use this code to dynamically find the last populated row in column C.
Code:
Dim lastRow as Long
lastRow = Cells(Rows.Count, "C").End(xlUp).Row
 
Upvote 0
Pick a column that will always have data in it for any populated row. Then use that to dynamically find where the last row is.
So, let's say that it is column "C". Then we can use this code to dynamically find the last populated row in column C.
Code:
Dim lastRow as Long
lastRow = Cells(Rows.Count, "C").End(xlUp).Row

Thanks! So I am kinda new to all of this. I added the code, but nothing new happened. I am sure I am forgetting to do something obvious...

[CODEDim lastRow As Long
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
VestingReport2Import_3Formula r, "H", "=abs(RC6-RC7)"][/CODE]
 
Upvote 0
What exactly is this?
Code:
2Import_3Formula r, "H", "=abs(RC6-RC7)"
That does not look like any sort of valid code I have ever seen.

Your post is missing some important details.
Can you post the WHOLE VBA procedure that you are trying to apply this to?
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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