Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Brisbane Rob
 
Posts: n/a
Default Macro to set print range


If my data starts in cell B5 but the number of columns and/or rows can
vary, how do I write a print macro to cover that if there are no gaps
in the data i.e. one solid range of data? And how do I get around the
problem of a blank line within the range?


--
Brisbane Rob
------------------------------------------------------------------------
Brisbane Rob's Profile: http://www.excelforum.com/member.php...o&userid=25096
View this thread: http://www.excelforum.com/showthread...hreadid=401725

  #2   Report Post  
duane
 
Posts: n/a
Default


I'd approach it this way - find the last row from bottom and last column
from the right

dim prange as range
endrow = cells(65536,2).end(xlup).row
'assumes there is always something in column b
endcol = cells(2,256).end(xltoleft).column
' assumes there is alway something in row 2
prange = range (cells(5,2) , cells(endrow,endcol))


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=401725

  #3   Report Post  
Brisbane Rob
 
Posts: n/a
Default


That seems to work fine. Many thanks - much appreciated.


--
Brisbane Rob
------------------------------------------------------------------------
Brisbane Rob's Profile: http://www.excelforum.com/member.php...o&userid=25096
View this thread: http://www.excelforum.com/showthread...hreadid=401725

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW DO I PRINT USING A MACRO? JeffC Excel Discussion (Misc queries) 2 August 24th 05 11:49 AM
how do I print a range without printing the blank pages? Chris VP Excel Discussion (Misc queries) 2 May 2nd 05 07:08 PM
Printing - Have to set print area 1 column further than necessary STUART BISSET Excel Discussion (Misc queries) 0 January 24th 05 07:59 PM
I WANT TO SET PRINT RANGE TO NUMBER OF COLUMNS ckbusia Setting up and Configuration of Excel 2 January 20th 05 07:47 PM
Macro for changing print settings Bill Excel Discussion (Misc queries) 3 December 3rd 04 10:49 PM


All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"