#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Fine Tuning

Hi...

The code below loads and unloads a sheet (to be visible to or not) depending
on a value entered into the Frontpage Sheet. How can I modify this so the
same value will make visible (or not) more sheets called
R,A,B,Ba,Rs,Co,Bf,Bs,Pa,Pt,Pa,Ea. Is this easy to do?

I'm trying to get users to enter a user number so that only they can use
what I've created.

Private Sub Worksheet_Calculate()
Dim sh As Worksheet
Set sh = Worksheets("FRONTPAGE")
With Sheets("Spa")
If sh.Range("e21").Value = 1 Then
.Visible = xlSheetHidden
ElseIf sh.Range("e21").Value = 0 Then

.Visible = xlSheetVisible
End If
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Fine Tuning

Hi

Try if this is what you want:

Private Sub Worksheet_Calculate()

Dim sh As Worksheet
SheetArray = Array("R", "A", "B", "Ba", "Rs", "Co", _
"Bf", "Bs", "Pa", "Pt", "Pa", "Ea", "Spa")
Set sh = Worksheets("FRONTPAGE")
For sht = LBound(SheetArray) To UBound(SheetArray)
With Sheets(SheetArray(sht))
If sh.Range("e21").Value = 1 Then
.Visible = xlSheetHidden
ElseIf sh.Range("e21").Value = 0 Then
.Visible = xlSheetVisible
End If
End With
Next
End Sub

Regards,
Per

"Gordon" skrev i meddelelsen
...
Hi...

The code below loads and unloads a sheet (to be visible to or not)
depending
on a value entered into the Frontpage Sheet. How can I modify this so the
same value will make visible (or not) more sheets called
R,A,B,Ba,Rs,Co,Bf,Bs,Pa,Pt,Pa,Ea. Is this easy to do?

I'm trying to get users to enter a user number so that only they can use
what I've created.

Private Sub Worksheet_Calculate()
Dim sh As Worksheet
Set sh = Worksheets("FRONTPAGE")
With Sheets("Spa")
If sh.Range("e21").Value = 1 Then
.Visible = xlSheetHidden
ElseIf sh.Range("e21").Value = 0 Then

.Visible = xlSheetVisible
End If
End With
End Sub


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
Macro fine Run fine from Select but not from KB Shortcut? [email protected] Excel Discussion (Misc queries) 8 August 31st 06 02:06 AM
help w/ fine tuning Mike New Users to Excel 1 October 19th 05 08:58 PM
Fine tuning if statement.... Derek Witcher[_2_] Excel Programming 6 October 12th 04 04:07 PM
Fine-tuning selection change event for merged cells & wrap text Lucy Barber Excel Programming 0 September 7th 04 10:10 PM
Tuning Off Toolbars Phil Hageman[_3_] Excel Programming 4 October 28th 03 09:21 PM


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