If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 |
Thread Tools | |
Display Modes | |
|
|