Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHANGE PRINT RANGE MACRO 1

Status
Not open for further replies.

EVE734

Technical User
Mar 29, 2005
47
US
Hi - I am trying to create a macro in Excel which will update the print area range based on cells I have designated using an "address" function to locate specific start and end cells. I am a novice user and tried to use the "record macro" feature of Excel.

The code I am trying to manipulate is:
ActiveSheet.PageSetup.PRINTAREA = "($CC$6):($CC$10)"

However, I don't want it to use cells CC6 and CC10, but rather the values of those cells.

Thanks for any help you can provide -
Evelyn
 


Hi,
The code I am trying to manipulate is:
ActiveSheet.PageSetup.PRINTAREA = "($CC$6):($CC$10)"

However, I don't want it to use cells CC6 and CC10, but rather the values of those cells.
I do not understand.

Your code is
Code:
ActiveSheet.PageSetup.PRINTAREA = "$CC$6:$CC$10"
That defines the range that you want to PRINT. In doing so, you will Print the VALUES that are in those cells.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Sorry for the confusion. I do not want to print range CC6:CC10. Cells CC6 and CC10 use "address" formulas to obtain the print range that I actually want. The print range will vary as I have multiple columns and rows which will be hidden based on certain criteria. The value in CC6 in this example is $A$8 and in CC10 is $R$173 - the print range I would like is $A$8:$R$173, but the next time I run the report, the range could be different depending on the values in those cells.

Hope this makes sense.
 


Code:
ActiveSheet.PageSetup.PRINTAREA = Range("$CC$6").Value & ":" & Range("$CC$10").Value

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I spent all morning trying to get this - Thank you so much Skip!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top