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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Range("S65536").End(xlup)

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

Does that help?
 
Upvote 0
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
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,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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