Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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
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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
Screen vs. Printed Aspect Ratio Jive Excel Discussion (Misc queries) 1 November 2nd 09 02:27 PM
Can macro display a diff't screen while it runs until it stops? KT Excel Programming 2 January 5th 06 08:49 PM
Turning off screen update while macro runs dancingflames Excel Programming 1 November 4th 05 10:39 PM
Flickering of the Screen when the Macro runs. Neeraja Excel Programming 3 October 28th 03 10:40 PM


All times are GMT +1. The time now is 03:19 PM.

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"