View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Luke M[_4_] Luke M[_4_] is offline
external usenet poster
 
Posts: 457
Default worksheet change question

Code appears to work fine for me. Are you sure you're using the
Worksheet_SelectionChange event?

--
Best Regards,

Luke M
"Tonso" wrote in message
...
As I scroll across a particular spreadsheet, I would like to have the
following columns change width, and zoom, as shown in the code below.
However, the results are erractic. The zoom only works on the last
column, and all the widths are 20. How do I correct this situation so
each column behaves as I want?

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 = 27
ActiveWindow.Zoom = Sheets("Notes").Range("c28")
Else
Columns(10).ColumnWidth = 3.33
'ActiveWindow.Zoom = Sheets("Notes").Range("c27")
End If