ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to change column width and active window zoom as columns areselected (https://www.excelbanter.com/excel-programming/441885-macro-change-column-width-active-window-zoom-columns-areselected.html)

Billy[_6_]

Macro to change column width and active window zoom as columns areselected
 
Using Excel 2003, I want to be able to:
1. go from column to column and have the width change as specified.
2. Have the zoom increase as specified in cells c27 (normal % zoom)
and c 28 (zoomed % zoom).
3. Limit these functions to rows 14, so if the active row becomes
<14, the zoom and the column width returns to normal.
I have worked with the following code, but the zoom does not seem to
work. I would appreciate any help in solving this problem.

Thanks,

Tonso

If Target.Column = 7 Then
Target.Columns.ColumnWidth = 20
ActiveWindow.Zoom = Sheets("Notes").Range("c28") 'c28 = 100
Else
Columns(7).ColumnWidth = 3.33
ActiveWindow.Zoom = Sheets("Notes").Range("c27") 'c27 = 80
End If
If Target.Column = 8 Then
Target.Columns.ColumnWidth = 34
ActiveWindow.Zoom = Sheets("Notes").Range("c28")
Else
Columns(8).ColumnWidth = 3.33
'ActiveWindow.Zoom = Sheets("Notes").Range("c27")
End If
If Target.Column = 9 Then
Target.Columns.ColumnWidth = 20
ActiveWindow.Zoom = Sheets("Notes").Range("c28")
Else
Columns(9).ColumnWidth = 3.33
'ActiveWindow.Zoom = Sheets("Notes").Range("c27")
End If
If Target.Column = 10 Then
Target.Columns.ColumnWidth = 20
ActiveWindow.Zoom = Sheets("Notes").Range("c28")
Else
Columns(10).ColumnWidth = 3.33
'ActiveWindow.Zoom = Sheets("Notes").Range("c27")
End If


All times are GMT +1. The time now is 04:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com