Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Set Print Area

Hi

I have a workbook with lots of worksheets

How can I do the following ........

Set the print area of every worksheet in the work book to A1:A10

Enter the same text in to Cell A1

And change the colour of Cell A2 to red

I only know a little VB so please keep it simple


Thanks

Katie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Set Print Area

Katie, here is one way

Sub test()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").FormulaR1C1 = "This Is A1"
ws.Range("A2").Interior.ColorIndex = 3
ws.PageSetup.PrintArea = "$A$1:$A$10"
Next ws
Application.ScreenUpdating = True
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Katie Hoys" wrote in message
...
Hi

I have a workbook with lots of worksheets

How can I do the following ........

Set the print area of every worksheet in the work book to A1:A10

Enter the same text in to Cell A1

And change the colour of Cell A2 to red

I only know a little VB so please keep it simple


Thanks

Katie




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Set Print Area


"Paul B" wrote in message
...
Katie, here is one way

Sub test()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").FormulaR1C1 = "This Is A1"
ws.Range("A2").Interior.ColorIndex = 3
ws.PageSetup.PrintArea = "$A$1:$A$10"
Next ws
Application.ScreenUpdating = True
End Sub


Thankyou !

Works a treat


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Set Print Area


"Paul B" wrote in message
...
Katie, here is one way

Sub test()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").FormulaR1C1 = "This Is A1"
ws.Range("A2").Interior.ColorIndex = 3
ws.PageSetup.PrintArea = "$A$1:$A$10"
Next ws
Application.ScreenUpdating = True
End Sub


What if I want to change the color to 'no fill' ?

Is there an associated number to use like Colorindex = 3 equals Red

No fill = ???????


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Set Print Area

Katie, use this, Interior.ColorIndex = xlNone

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Katie Hoys" wrote in message
...

"Paul B" wrote in message
...
Katie, here is one way

Sub test()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").FormulaR1C1 = "This Is A1"
ws.Range("A2").Interior.ColorIndex = 3
ws.PageSetup.PrintArea = "$A$1:$A$10"
Next ws
Application.ScreenUpdating = True
End Sub


What if I want to change the color to 'no fill' ?

Is there an associated number to use like Colorindex = 3 equals Red

No fill = ???????






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Set Print Area

Katie

No fill colorindex = -4142

Note the minus(-) sign.

Gord Dibben Excel MVP

On Sun, 12 Dec 2004 00:11:37 GMT, "Katie Hoys" wrote:


"Paul B" wrote in message
...
Katie, here is one way

Sub test()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").FormulaR1C1 = "This Is A1"
ws.Range("A2").Interior.ColorIndex = 3
ws.PageSetup.PrintArea = "$A$1:$A$10"
Next ws
Application.ScreenUpdating = True
End Sub


What if I want to change the color to 'no fill' ?

Is there an associated number to use like Colorindex = 3 equals Red

No fill = ???????


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Set Print Area

Thanks for all your help Paul and Gord

:-)


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
set area in excel not giving me option to set print area? J Littlebear Excel Discussion (Misc queries) 4 April 23rd 23 09:04 PM
File, print area, clear area, is not working cblind New Users to Excel 2 September 12th 07 04:51 PM
print area across the freeze panes area tom Excel Worksheet Functions 2 January 6th 07 05:23 PM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM


All times are GMT +1. The time now is 11:48 PM.

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

About Us

"It's about Microsoft Excel"