Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extending sub to cover other target cells
How could the sub below* be extended to cover additional cells besides C2,
viz.: the zoom to 120 should work for: C2, C25, C48, C71, C94 (the other cells in col C are offset to the start cell C2 by 24) *from Debra's site Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$C$2" Then ActiveWindow.Zoom = 120 Else ActiveWindow.Zoom = 100 End If End Sub Thanks -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extending sub to cover other target cells
Oops, line
(the other cells in col C are offset to the start cell C2 by 24) should read: (the other cells in col C are offset to the start cell C2 by steps of 24) -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extending sub to cover other target cells
Instead of
If Target.Address = "$C$2" Then use If ((Target.Column = 3) And ((Target.Row Mod 23) = 2)) Then (This uses steps of 23 per the cell addresses listed; if you need the last matching cell to be C94, you could further qualify it with "And (Target.Row <= 94)" ). "Max" wrote: How could the sub below* be extended to cover additional cells besides C2, viz.: the zoom to 120 should work for: C2, C25, C48, C71, C94 (the other cells in col C are offset to the start cell C2 by 24) *from Debra's site Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$C$2" Then ActiveWindow.Zoom = 120 Else ActiveWindow.Zoom = 100 End If End Sub Thanks -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extending sub to cover other target cells
Thanks, bpeltzer !
That works great. -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- "bpeltzer" wrote in message ... Instead of If Target.Address = "$C$2" Then use If ((Target.Column = 3) And ((Target.Row Mod 23) = 2)) Then (This uses steps of 23 per the cell addresses listed; if you need the last matching cell to be C94, you could further qualify it with "And (Target.Row <= 94)" ). |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extending sub to cover other target cells
I like:
if target.cells.count 1 then exit sub 'one cell at a time if intersect(target, me.range("c2,c25,c48,c71,c94")) is nothing then exit sub end if Especially when there doesn't seem to be a pattern. Max wrote: How could the sub below* be extended to cover additional cells besides C2, viz.: the zoom to 120 should work for: C2, C25, C48, C71, C94 (the other cells in col C are offset to the start cell C2 by 24) *from Debra's site Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$C$2" Then ActiveWindow.Zoom = 120 Else ActiveWindow.Zoom = 100 End If End Sub Thanks -- Rgds Max xl 97 --- Singapore, GMT+8 xdemechanik http://savefile.com/projects/236895 -- -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How many cells can a correlation function cover? | Excel Discussion (Misc queries) | |||
Data entered needs to cover 2 vertical cells | Excel Discussion (Misc queries) | |||
Target cell reference moves when target is cut and pasted | Excel Discussion (Misc queries) | |||
Help - loop through cells in a range that are not together (several different cells as Target) | Excel Programming | |||
How find if target is object in Worksheet_Change (ByVal Target As.. ?) | Excel Programming |