range help!

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
193
Hi there,

I have a worksheet, that has data, but want to start the capture on line 9.
I tried to use the below to find the last row for S9, but seems when running this, it only copies/pastes F9. I would like it to continue until the last row of S9:end. Note that S9 starts with values, then has blank values, but further down has more text. Ideally I'd like to stop this at the 1st blank from the top.

VBA Code:
Dim lrD&: lrD = ActiveSheet.Cells.Find("*", [S9], _
xlFormulas, SearchDirection:=xlPrevious).Row

   'For understanding LR = Last Row

   'LRD = Cells(Rows.Count, 13).End(xlUp)


Set Siderng = Range("F9:F" & lrD)


when I tried this, it pulled in 300 ish line items, which does not take into account of the blank row stop point.

VBA Code:
LRD = Cells(Rows.Count, 13).End(xlUp)

Any ideas?
 

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.
The number 13 in the second piece of code indicates your column number that it will use to search for the last row. So that is Column "M".

Yet, you indicate above you want to look in Column "S", which for me is col num 19.

Does replacing 13 with 19 get you what you need ?

cheers
Rob
 
Upvote 0
try something along the lines of
VBA Code:
lrD = ActiveSheet.Range("S9:S" & Rows.Count).Find("").Row - 1
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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