View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steve E Steve E is offline
external usenet poster
 
Posts: 62
Default Worksheet_Change event to unhide columns based on value in ran

Bingo.

Is there a good site where I can try and learn more about how to structure
multiple worksheet_change events like this? At a VBA for beginners level?

Many many thanks.

Steve

"Jim Cone" wrote:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Me.Range("C18:X32,C37:H43"), .Cells) Is Nothing Then

Dim N As Long
Dim rng As Excel.Range
Set rng = Me.Range("O18:O32")

Application.EnableEvents = False
Me.Unprotect (PWORD_Worksheet)
With Me.Range("E1")
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With

For N = 1 To rng.Count
If rng(N).Value = "wordsincell" Then
Me.Range("R:T").EntireColumn.Hidden = False
Exit For
End If
Next

Me.Protect (PWORD_Worksheet)
Application.EnableEvents = True
End If
End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html




"Steve E"
wrote in message
Jim,
Thanks so much for looking at this with me.
That code works fine but I am trying to incorporate the "unhide rows R:T
when O18:O32 = "wordswrittenincell" " bit with the E1 = Now when there is a
change to the ("C18:X32,C37:H43") range.
The only thing that the two statements have in common is that they are both
worksheet_change events...
Am I really so dense that I can't make sense of this?
SE