Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Zoom on selection

I have the following code to "zoom" on a selection of one
or more chosen cells.:

Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Range
("B63:B65,G47:G48,G53,G64,G65,L58,L60:l65,M3")) Is
Nothing Then
ActiveWindow.Zoom = 70
Else
ActiveWindow.Zoom = 100
End If
End Sub


My problem is I want to "zoom" when I select a merged
cell "G73:H75", I've tried adding this range to the
selection range in the above code but this isn't working.

Any Ideas?????
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Zoom on selection

Wayne,

A merged cell target has a cell count of more than 1, so you want to exit
only if the target cells count is 1 and target is not G73:H75. Also, it
seems that if the target includes other cells along with G73:H75 you want to
exit. This led me to the following tortured logic. Tested in XL97 and 2000
(97 sometimes acts differently with merged cells, but it seemed to be okay
with this):

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Not (Target.Cells.Count = 1 Or (Not Intersect(Target, Range("G73:H75"))
Is Nothing And Target.Cells.Count = 6)) Then
Exit Sub
ElseIf Intersect(Target,
Range("B63:B65,G47:G48,G53,G64,G65,L58,L60:l65,M3, G73:H75")) Is Nothing Then
ActiveWindow.Zoom = 70
Else
ActiveWindow.Zoom = 100
End If

End Sub

hth,

Doug

"Wayne" wrote in message
...
I have the following code to "zoom" on a selection of one
or more chosen cells.:

Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Range
("B63:B65,G47:G48,G53,G64,G65,L58,L60:l65,M3")) Is
Nothing Then
ActiveWindow.Zoom = 70
Else
ActiveWindow.Zoom = 100
End If
End Sub


My problem is I want to "zoom" when I select a merged
cell "G73:H75", I've tried adding this range to the
selection range in the above code but this isn't working.

Any Ideas?????



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Zoom on selection

Hi Wayne.
Is this what you were looking for?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$G$73:$H$75" Then _
ActiveWindow.Zoom = 100: Exit Sub
If ActiveWindow.Zoom < 70 Then ActiveWindow.Zoom = 70
End Sub


Regards Robert

"Wayne" wrote in message ...
I have the following code to "zoom" on a selection of one
or more chosen cells.:

Private Sub Worksheet_SelectionChange(ByVal Target As
Excel.Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Range
("B63:B65,G47:G48,G53,G64,G65,L58,L60:l65,M3")) Is
Nothing Then
ActiveWindow.Zoom = 70
Else
ActiveWindow.Zoom = 100
End If
End Sub


My problem is I want to "zoom" when I select a merged
cell "G73:H75", I've tried adding this range to the
selection range in the above code but this isn't working.

Any Ideas?????





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.590 / Virus Database: 373 - Release Date: 17/02/2004


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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Please help! Print Preview Zoom is Grayed Out...Doesn't zoom. PK Excel Discussion (Misc queries) 0 July 20th 09 03:33 PM
ZOOM alex Excel Worksheet Functions 2 February 22nd 08 07:05 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
How can I get a macro in Excel to set the Zoom to "Selection"? GarryH Excel Discussion (Misc queries) 2 December 21st 04 01:44 PM


All times are GMT +1. The time now is 11:46 AM.

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"