Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT placed in 2 sheets, but in ALL others

Sub Workbook_Info()
On Error Resume Next
With Sheets("1:50")
' If sheet is NOT sheet1 or sheet3 then
..Select
ActiveSheet.Unprotect
Range("R59").Select
ActiveCell.FormulaR1C1 = "=MAX('Page 1:" & Worksheets(Worksheets.Count).Name & "'!R[0]C[-8])"
ActiveSheet.protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
AllowFormattingCells:=True
End With
End Sub

The above code places the MAX value in cell R59 in ALL sheets in my workbook.
But i have discovered that i DO NOT want it to be placed in 2 sheets of the workbook.
Sheet1 and Sheet3.

How can skip sheet1 and 3 so they are not included in the code above?

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Value NOT placed in 2 sheets, but in ALL others

You need to loop through each sheet bypassing the ones you do not wish to
add the formula.

Dim X as Long
For X = 2 to 50
With Worksheets(X)
If .Name < "Sheet3" then
.Unprotect
.Range("R59").FormulaR1C1 = "=MAX('Page 1:" &
Worksheets(Worksheets.Count).Name & "'!R[0]C[-8])"
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
AllowFormattingCells:=True
End If
Next X

--

Regards,
Nigel




"Corey" wrote in message
...
Sub Workbook_Info()
On Error Resume Next
With Sheets("1:50")
' If sheet is NOT sheet1 or sheet3 then
.Select
ActiveSheet.Unprotect
Range("R59").Select
ActiveCell.FormulaR1C1 = "=MAX('Page 1:" &
Worksheets(Worksheets.Count).Name & "'!R[0]C[-8])"
ActiveSheet.protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
AllowFormattingCells:=True
End With
End Sub

The above code places the MAX value in cell R59 in ALL sheets in my
workbook.
But i have discovered that i DO NOT want it to be placed in 2 sheets of
the workbook.
Sheet1 and Sheet3.

How can skip sheet1 and 3 so they are not included in the code above?

Corey....



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
Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible? Corey Excel Programming 2 December 11th 06 01:35 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM


All times are GMT +1. The time now is 05:34 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"