Macro to change column width and active window zoom as columns areselected

B

Billy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top