LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Code to format cells on several worksheets

Hi

I have written the code below to ensure some key info is always visible in cells whether or not users unprotect the worksheet and delete the contents. The code is password protected.

Private Sub Workbook_Open()
Sheets("Sheet1").Select
Range("A1").Font.ColorIndex = 51
Range("A1:B1").Interior.Color = RGB(211, 206, 177)
Range("A1").Value = "KEEP THIS TEXT"
Selection.Locked = True
End Sub

The problem I have is, I can make this work on 1 sheet, but don't have a clue how to use it on other worksheets (eg, Sheet2, Sheet3, Sheet4, etc) in the workbook without repeating the code and changing the sheet reference.

The relevant cell is the same on every sheet, A1.

Please can someone advise how to modify the vb so I can do this?

Thanks - help would be much appreciated

Steve
 
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
Locked Several Worksheets, allow format cells/select unlocked cell Ana24 Excel Discussion (Misc queries) 2 September 26th 09 01:15 AM
FormatCellsSpecialZip Code MichaelRobert Excel Worksheet Functions 6 May 14th 08 09:46 PM
Format Cells by code Michael M Excel Worksheet Functions 3 April 4th 07 12:23 AM
Get multiple cells from all worksheets Code Not Work Rookie_User Excel Programming 1 January 25th 07 11:12 PM
Update Format of cells in multiple worksheets AliH Excel Programming 1 August 10th 05 12:19 PM


All times are GMT +1. The time now is 08:31 AM.

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"