Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Screen aspect ratios changes when macro runs
I have files that originated with the last four versions of Excel with
Windows XP and created on different screens and resolutions. Sometimes when I run certain macros that set a default width or row height on all the used cells, the view comes back distorted in one dimension. Rerunning the macro doesn't reset it and once changed after running the macros, I've not run across a way to fix it to my standard template values. Not sure, but it seems like it must have somethng to do with the original files which have been updated many times. Does anyone have any clues as to what is going on? The code is pretty simple. Here is the one for setting the columns: Sub FixDecreeAbstractColumnWidths(Optional control As IRibbonControl) ' ' FixColumnWidths Macro ' Resizes Abstract Column widths to standard format size ActiveWindow.Zoom = 100 Columns("A:A").Select Selection.ColumnWidth = 8 Columns("B:B").Select Selection.ColumnWidth = 2 Columns("C:C").Select Selection.ColumnWidth = 44 Columns("D:E").Select Selection.ColumnWidth = 2 Columns("F:F").Select Selection.ColumnWidth = 44 Columns("G:G").Select Selection.ColumnWidth = 2 Columns("H:H").Select Selection.ColumnWidth = 8 Columns("I:J").Select Selection.ColumnWidth = 8 Columns("K:K").Select Selection.ColumnWidth = 9 Columns("L:L").Select Selection.ColumnWidth = 8 Columns("M:M").Select Selection.ColumnWidth = 8 Columns("N:N").Select Selection.ColumnWidth = 9 Columns("O:P").Select Selection.ColumnWidth = 14 Columns("Q").Select Selection.ColumnWidth = 2 Columns("R:R").Select Selection.ColumnWidth = 36 Columns("S:S").Select Selection.ColumnWidth = 2 ActiveWindow.Zoom = 70 Range("N2").Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Screen aspect ratios changes when macro runs
I'd change it to this
Option Explicit Sub FixDecreeAbstractColumnWidths(Optional control As IRibbonControl) Dim aWS As Excel.Worksheet ' ' FixColumnWidths Macro ' Resizes Abstract Column widths to standard format size Set aWS = ActiveSheet 'ActiveWindow.Zoom = 100 Application.ScreenUpdating = False aWS.Columns("A:A").ColumnWidth = 8 aWS.Columns("B:B").ColumnWidth = 2 aWS.Columns("C:C").ColumnWidth = 44 aWS.Columns("D:E").ColumnWidth = 2 aWS.Columns("F:F").ColumnWidth = 44 aWS.Columns("G:G").ColumnWidth = 2 aWS.Columns("H:H").ColumnWidth = 8 aWS.Columns("I:J").ColumnWidth = 8 aWS.Columns("K:K").ColumnWidth = 9 aWS.Columns("L:L").ColumnWidth = 8 aWS.Columns("M:M").ColumnWidth = 8 aWS.Columns("N:N").ColumnWidth = 9 aWS.Columns("O:P").ColumnWidth = 14 aWS.Columns("Q").ColumnWidth = 2 aWS.Columns("R:R").ColumnWidth = 36 aWS.Columns("S:S").ColumnWidth = 2 Application.ScreenUpdating = True ActiveWindow.Zoom = 70 End Sub "owlnevada" wrote: I have files that originated with the last four versions of Excel with Windows XP and created on different screens and resolutions. Sometimes when I run certain macros that set a default width or row height on all the used cells, the view comes back distorted in one dimension. Rerunning the macro doesn't reset it and once changed after running the macros, I've not run across a way to fix it to my standard template values. Not sure, but it seems like it must have somethng to do with the original files which have been updated many times. Does anyone have any clues as to what is going on? The code is pretty simple. Here is the one for setting the columns: Sub FixDecreeAbstractColumnWidths(Optional control As IRibbonControl) ' ' FixColumnWidths Macro ' Resizes Abstract Column widths to standard format size ActiveWindow.Zoom = 100 Columns("A:A").Select Selection.ColumnWidth = 8 Columns("B:B").Select Selection.ColumnWidth = 2 Columns("C:C").Select Selection.ColumnWidth = 44 Columns("D:E").Select Selection.ColumnWidth = 2 Columns("F:F").Select Selection.ColumnWidth = 44 Columns("G:G").Select Selection.ColumnWidth = 2 Columns("H:H").Select Selection.ColumnWidth = 8 Columns("I:J").Select Selection.ColumnWidth = 8 Columns("K:K").Select Selection.ColumnWidth = 9 Columns("L:L").Select Selection.ColumnWidth = 8 Columns("M:M").Select Selection.ColumnWidth = 8 Columns("N:N").Select Selection.ColumnWidth = 9 Columns("O:P").Select Selection.ColumnWidth = 14 Columns("Q").Select Selection.ColumnWidth = 2 Columns("R:R").Select Selection.ColumnWidth = 36 Columns("S:S").Select Selection.ColumnWidth = 2 ActiveWindow.Zoom = 70 Range("N2").Select End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Screen aspect ratios changes when macro runs
Thanks for the quick response.
I added your code and it didn't affect anything at all. The widths of cols A to F picked up the 44 point width for some reason but cols G to V all are unchanged or the programmed width . . . A bit puzzling. Sometimes it will set all the widths to the same, usually the application default widths. . . Any Clue as to why? "Barb Reinhardt" wrote: I'd change it to this Option Explicit Sub FixDecreeAbstractColumnWidths(Optional control As IRibbonControl) Dim aWS As Excel.Worksheet ' ' FixColumnWidths Macro ' Resizes Abstract Column widths to standard format size Set aWS = ActiveSheet 'ActiveWindow.Zoom = 100 Application.ScreenUpdating = False aWS.Columns("A:A").ColumnWidth = 8 aWS.Columns("B:B").ColumnWidth = 2 aWS.Columns("C:C").ColumnWidth = 44 aWS.Columns("D:E").ColumnWidth = 2 aWS.Columns("F:F").ColumnWidth = 44 aWS.Columns("G:G").ColumnWidth = 2 aWS.Columns("H:H").ColumnWidth = 8 aWS.Columns("I:J").ColumnWidth = 8 aWS.Columns("K:K").ColumnWidth = 9 aWS.Columns("L:L").ColumnWidth = 8 aWS.Columns("M:M").ColumnWidth = 8 aWS.Columns("N:N").ColumnWidth = 9 aWS.Columns("O:P").ColumnWidth = 14 aWS.Columns("Q").ColumnWidth = 2 aWS.Columns("R:R").ColumnWidth = 36 aWS.Columns("S:S").ColumnWidth = 2 Application.ScreenUpdating = True ActiveWindow.Zoom = 70 End Sub "owlnevada" wrote: I have files that originated with the last four versions of Excel with Windows XP and created on different screens and resolutions. Sometimes when I run certain macros that set a default width or row height on all the used cells, the view comes back distorted in one dimension. Rerunning the macro doesn't reset it and once changed after running the macros, I've not run across a way to fix it to my standard template values. Not sure, but it seems like it must have somethng to do with the original files which have been updated many times. Does anyone have any clues as to what is going on? The code is pretty simple. Here is the one for setting the columns: Sub FixDecreeAbstractColumnWidths(Optional control As IRibbonControl) ' ' FixColumnWidths Macro ' Resizes Abstract Column widths to standard format size ActiveWindow.Zoom = 100 Columns("A:A").Select Selection.ColumnWidth = 8 Columns("B:B").Select Selection.ColumnWidth = 2 Columns("C:C").Select Selection.ColumnWidth = 44 Columns("D:E").Select Selection.ColumnWidth = 2 Columns("F:F").Select Selection.ColumnWidth = 44 Columns("G:G").Select Selection.ColumnWidth = 2 Columns("H:H").Select Selection.ColumnWidth = 8 Columns("I:J").Select Selection.ColumnWidth = 8 Columns("K:K").Select Selection.ColumnWidth = 9 Columns("L:L").Select Selection.ColumnWidth = 8 Columns("M:M").Select Selection.ColumnWidth = 8 Columns("N:N").Select Selection.ColumnWidth = 9 Columns("O:P").Select Selection.ColumnWidth = 14 Columns("Q").Select Selection.ColumnWidth = 2 Columns("R:R").Select Selection.ColumnWidth = 36 Columns("S:S").Select Selection.ColumnWidth = 2 ActiveWindow.Zoom = 70 Range("N2").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Screen vs. Printed Aspect Ratio | Excel Discussion (Misc queries) | |||
Can macro display a diff't screen while it runs until it stops? | Excel Programming | |||
Turning off screen update while macro runs | Excel Programming | |||
Flickering of the Screen when the Macro runs. | Excel Programming |