![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
I want to know how to select print area within the macro if report is going to be of varied length within a macro if i do ctrl+shift+end in the macro it sets it to the length of current report but when i run a longer report the print area is not proper
any idea? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
If your "current" Print Area is something like
A1:H46 put this as your NEW Print Area. A:H It'll adjust itself automatically. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
If your print range is in Columns A:H and you don't know how long it will be, this should work for you.
Dim ReportRange as Range 'Sets Ranges from A1 to 'the last cell with data in column H 'which is searched for by starting with cell H65536 and 'going up to the last cels with data in column H Set ReportRange = Range("A1",Range("H65536").End(xlup).Address) ReportRange.Select |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|