macro help

Dummy Excel

Well-known Member
Joined
Sep 21, 2005
Messages
1,004
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Hi All,
I have some data that I need to select, my formula is:
Range("I8:S8").Select
Range(Selection, Selection.End(xlDown)).Select

The problem with this is that once it sees one blank (empty) cell it stops, and there is probably another 10 rows of data I need to capture. is there a way that I can rewrite the code to say once all the cells are empty in the range of columns I to S then select all that???

any help is greatly appreciated
Sam
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,348
Range("S65536").End(xlup)

will return the last entry in column S, even if there are blanks above it.

Does that help?
 
Upvote 0

Dummy Excel

Well-known Member
Joined
Sep 21, 2005
Messages
1,004
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
thanks for your help mikerickson - unfortunately I cant do that as I have a chart under the data - I need the chart there so that I can print the data and chart on one sheet.

Sorry I shouldve mentioned that in my original post
 
Upvote 0

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,348
A chart doesn't interfere with that. The code only looks at what is in cells, not at what is embedded in the sheet.
 
Upvote 0

Forum statistics

Threads
1,191,415
Messages
5,986,428
Members
440,029
Latest member
GabSSSH

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