Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 90
Default 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   Report Post  
Posted to microsoft.public.excel.misc
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
worksheet change question Tonso Excel Discussion (Misc queries) 2 April 2nd 10 05:46 PM
Quick VBA Worksheet Change Event or Selection Question: Damil4real Excel Worksheet Functions 6 November 17th 09 10:28 PM
change formula in a shared worksheet without losing change history DCE Excel Worksheet Functions 5 July 25th 08 01:37 PM
Hyperlink Question -- Change in Worksheet Name? BG Excel Worksheet Functions 1 March 23rd 08 02:39 PM
Worksheet change Macro Question Vick Excel Discussion (Misc queries) 11 January 30th 08 03:09 PM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"