Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Willie Howell   on Mar 04 In MS Office Category.

  
Question Answered By: Damon Perez   on Mar 04


What i'd like to do is specify a range  of cells  to be protected when hidden  ie
I6:M6,P6:T6,W6:AA6,AD6:AH6
and the same cells to be unprotected when unhidden.All controlled by a toggle
switch.

I also need the same on alternate rows  ie I8,I10,I12 ect

Any guidance on this very much appreicated.

Here is the code  i'm using.



Private Sub ToggleButton1_Click()

With ToggleButton1

Range("A6,A8,A10,A12,A14,A16,A18,A20,A22,A24,A26,A28,A30,A32,A34,A36").EntireRow\
.Hidden = .Value

End With
End Sub


Private Sub Worksheet_Change(ByVal target  As Range)

' Character Input as Caps

Static booBusy As Boolean
If booBusy = True Then Exit Sub
booBusy = True
Dim rngCell As Range, rngIntersect As Range
Set rngIntersect = Application.Intersect(Target, Range("B1:AQ37"))
On Error Resume Next
For Each rngCell In rngIntersect
rngCell.Value = UCase(rngCell.Value)
Next rngCell
On Error GoTo 0
booBusy = False

'Conditional Formatting

Dim rng As Range

Set rng = Intersect(Target,
Range("I7:M37,Q7:T37,W7:AA37,AD7:AH37,AK7:AK37"))
If rng Is Nothing Then
Exit Sub
Else
Dim cl As Range
For Each cl In rng
Select Case cl.Text
Case ""
cl.Interior.ColorIndex = 0
Case "V"
cl.Interior.ColorIndex = 42
Case "M"
cl.Interior.ColorIndex = 45
Case "C"
cl.Interior.ColorIndex = 7
Case "T"
cl.Interior.ColorIndex = 14
Case "TB"
cl.Interior.ColorIndex = 5
Case "H"
cl.Interior.ColorIndex = 4
Case "HD"
cl.Interior.ColorIndex = 4
Case "S"
cl.Interior.ColorIndex = 3
Case "B"
cl.Interior.ColorIndex = 16
Case "MD"
cl.Interior.ColorIndex = 43
Case Else
Exit Sub
End Select
Next cl
End If

End Sub

Share: 

 

This Question has 13 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to run multiple procedure within Vba Or get search suggestion and latest updates.


Tagged: