View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave W[_3_] Dave W[_3_] is offline
external usenet poster
 
Posts: 4
Default simple code problem

I have imported some code to enlarge the window while
picking data valadation lists from the Contextures website

When i put these on the same sheet code module
I get an compile error mesaage
It won't let me use Worksheet_SelectionChange twice on
the same sheet module

what is the best solution to this?

Is it alright just to insert the second line of code
after the first without the Private Sub
Worksheet...sentence.

Thanks in advance for any help

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Target.Address = "$A$2" Then
ActiveWindow.Zoom = 120
Else
ActiveWindow.Zoom = 100
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Dim rngDV As Range
Application.EnableEvents = False
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If rngDV Is Nothing Then Exit Sub
If Intersect(Target, rngDV) Is Nothing Then
ActiveWindow.Zoom = 100
Else
ActiveWindow.Zoom = 120
End If
Application.EnableEvents = True
End Sub