LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default simple code problem

Thank you, that's what I needed.
-----Original Message-----
Dave,

Try this then

Private Sub Worksheet_SelectionChange(ByVal Target As

Range)
Dim rngDV As Range
Application.EnableEvents = False
On Error GoTo ws_exit
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
If rngDV Is Nothing Then Exit Sub
Select Case True
Case Not Intersect(Target, rngDV) Is Nothing:
ActiveWindow.Zoom = 120
Case Target.Address = "$A$2":
ActiveWindow.Zoom = 120
Case Else:
ActiveWindow.Zoom = 100
End Select

ws_exit:
Application.EnableEvents = True
On Error GoTo 0
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dave W" wrote in

message
...
thank you for the quick answer but the first one just
zooms when selecting a single cell and the second one
zooms when any cell that contains data validation list

is
selected. I have a cell that I want to zoom that does

not
have a data validation list.

Should I combine the codes some how?

-----Original Message-----
They are doing the same thing, on different ranges.

Delete the first.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Dave W" wrote in

message
...
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




.



.



 
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
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Help with some simple code Angeline Excel Discussion (Misc queries) 4 October 12th 06 09:06 AM
simple code gavmer[_5_] Excel Programming 4 May 19th 04 03:32 AM
Help With Very Simple Code pauluk[_17_] Excel Programming 7 April 8th 04 10:45 AM
Simple For Each Next code Marek S. Excel Programming 0 July 28th 03 12:34 PM


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