Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
worksheet change question
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
worksheet change question | Excel Discussion (Misc queries) | |||
Quick VBA Worksheet Change Event or Selection Question: | Excel Worksheet Functions | |||
change formula in a shared worksheet without losing change history | Excel Worksheet Functions | |||
Hyperlink Question -- Change in Worksheet Name? | Excel Worksheet Functions | |||
Worksheet change Macro Question | Excel Discussion (Misc queries) |