Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have several Macro's thst toggle on/off see example text line on/off below
Sub text_wrap() ' ' text_wrap Macro ' Macro recorded 3/24/2008 by Raytheon ' With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom If .WrapText = False Then .WrapText = True Else .WrapText = False End If .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub this works OK I am trying to write a macro that can zoom in to 120% and then zoom back out to 100% my code below does not work Sub zoom() ' ' Zoom Macro ' Macro recorded 3/15/2010 by ' If ActiveWindow.zoom.Percentage = 120 Then ActiveWindow.zoom.Percentage = 100 Else ActiveWindow.zoom.Percentage = 120 End If End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Correct coding is just:
ActiveWindow.Zoom = 100 Also, your Text_wrap sub could be greatly condensed to simply be: With Selection ..WarpText = Not(.WrapText) End With -- Best Regards, Luke M "RVF" wrote in message ... I have several Macro's thst toggle on/off see example text line on/off below Sub text_wrap() ' ' text_wrap Macro ' Macro recorded 3/24/2008 by Raytheon ' With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom If .WrapText = False Then .WrapText = True Else .WrapText = False End If .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub this works OK I am trying to write a macro that can zoom in to 120% and then zoom back out to 100% my code below does not work Sub zoom() ' ' Zoom Macro ' Macro recorded 3/15/2010 by ' If ActiveWindow.zoom.Percentage = 120 Then ActiveWindow.zoom.Percentage = 100 Else ActiveWindow.zoom.Percentage = 120 End If End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this one:
If ActiveWindow.Zoom = 120 Then ActiveWindow.Zoom = 100 Else ActiveWindow.Zoom = 120 End If Regards, Per "RVF" skrev i meddelelsen ... I have several Macro's thst toggle on/off see example text line on/off below Sub text_wrap() ' ' text_wrap Macro ' Macro recorded 3/24/2008 by Raytheon ' With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom If .WrapText = False Then .WrapText = True Else .WrapText = False End If .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub this works OK I am trying to write a macro that can zoom in to 120% and then zoom back out to 100% my code below does not work Sub zoom() ' ' Zoom Macro ' Macro recorded 3/15/2010 by ' If ActiveWindow.zoom.Percentage = 120 Then ActiveWindow.zoom.Percentage = 100 Else ActiveWindow.zoom.Percentage = 120 End If End Sub |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Have you tried:
If ActiveWindow.Zoom = 100 Then ActiveWindow.Zoom = 120 Else ActiveWindow.Zoom = 100 End If (or just to keep your logic) If ActiveWindow.Zoom = 120 Then ActiveWindow.Zoom = 100 Else ActiveWindow.Zoom = 120 End If "RVF" wrote: I have several Macro's thst toggle on/off see example text line on/off below Sub text_wrap() ' ' text_wrap Macro ' Macro recorded 3/24/2008 by Raytheon ' With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom If .WrapText = False Then .WrapText = True Else .WrapText = False End If .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub this works OK I am trying to write a macro that can zoom in to 120% and then zoom back out to 100% my code below does not work Sub zoom() ' ' Zoom Macro ' Macro recorded 3/15/2010 by ' If ActiveWindow.zoom.Percentage = 120 Then ActiveWindow.zoom.Percentage = 100 Else ActiveWindow.zoom.Percentage = 120 End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |