help need to select Print Area

  • Thread starter Thread starter SMILE
  • Start date Start date
S

SMILE

Hello
I hope someone will help me to solve my problem.
I have the data from column A to G (from H.. everything is blank) an
I keep adding data below it. Is there any way I can run a macro t
select the print area by finding the last row? Eg: if I have data in 1
rows and when I run the macro it should select the range A1-G16 and se
the print area. Row 17 will have no data in it.
Hope it is clear.
Thanks in Advance
Regds
Tom
 
If the data is continuous in column A this should work:

Range(Range("A1"), Range("A1").End(xlDown)).Resize(, 7).Name = "Print_Area"

--
Jim Rech
Excel MVP
| Hello
| I hope someone will help me to solve my problem.
| I have the data from column A to G (from H.. everything is blank) and
| I keep adding data below it. Is there any way I can run a macro to
| select the print area by finding the last row? Eg: if I have data in 16
| rows and when I run the macro it should select the range A1-G16 and set
| the print area. Row 17 will have no data in it.
| Hope it is clear.
| Thanks in Advance
| Regds
| Toms
|
|
| ---
| Message posted
|
 
Please trying running the code before deciding it doesn't work.

--
Jim Rech
Excel MVP
| Jim
|
| But I have the Data in A ,B,C,D,E,F,G
|
| Hope I can get a solution
| Thanks
| Toms
|
|
| ---
| Message posted
|
 
Hi Jim

Thanks for the help
I am sorry that I did not try it before replying. Now I tried and it
working perfect. Thanks a million
Toms
 
Hi...

I find the code below working perfect to select the print area.
Now I need the print area without the last line.
What if I need the print area without the last line.

Can someone help??

Range(Range("A1"), Range("A1").End(xlDown)).Resize(, 7).Name
"Print_Area"


Thanks
Tom
 
Just a suggestion:

Range(Range("A1"), Range("A1").End(xlDown)(0)).Resize(, 7).Name =
"Print_Area"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top