A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

vba code to get an duse the value from a particular cell



 
 
Thread Tools Display Modes
  #1  
Old March 30th, 2010, 11:26 PM posted to microsoft.public.excel.misc
Tonso
external usenet poster
 
Posts: 69
Default vba code to get an duse the value from a particular cell

Using xl2003, I have the following Worksheet Selection Change code:

If Target.Column = 5 Then
Target.Columns.ColumnWidth = 27.11
ActiveWindow.Zoom = 85
Else
Columns(5).ColumnWidth = 3.78
'ActiveWindow.Zoom = 75
End If

I would like to be able to change the values zoom 85 and 75 to
correspond to the values in 2 cells, for eample, Notes!B5 and Notes!
B6, so the zoom factors can be set as needed. How can this be done?

As always,

Thanks,

Tonso
  #2  
Old March 30th, 2010, 11:43 PM posted to microsoft.public.excel.misc
ozgrid.com
external usenet poster
 
Posts: 328
Default vba code to get an duse the value from a particular cell

If Target.Cells.Count 1 Then Exit Sub

If Target(1,1).Address = $B$5 Then ActiveWindow.Zoom = 85

If Target(1,1).Address = $B$6 Then ActiveWindow.Zoom = 75



"Tonso" wrote in message
...
Using xl2003, I have the following Worksheet Selection Change code:

If Target.Column = 5 Then
Target.Columns.ColumnWidth = 27.11
ActiveWindow.Zoom = 85
Else
Columns(5).ColumnWidth = 3.78
'ActiveWindow.Zoom = 75
End If

I would like to be able to change the values zoom 85 and 75 to
correspond to the values in 2 cells, for eample, Notes!B5 and Notes!
B6, so the zoom factors can be set as needed. How can this be done?

As always,

Thanks,

Tonso


  #3  
Old March 30th, 2010, 11:47 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default vba code to get an duse the value from a particular cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 Then
Target.Columns.ColumnWidth = 27.11
ActiveWindow.Zoom = Sheets("Notes").Range("B5") '85
Else
Columns(5).ColumnWidth = 3.78
ActiveWindow.Zoom = Sheets("Notes").Range("B6") '75
End If
End Sub


Gord Dibben MS Excel MVP

On Tue, 30 Mar 2010 15:26:44 -0700 (PDT), Tonso
wrote:

Using xl2003, I have the following Worksheet Selection Change code:

If Target.Column = 5 Then
Target.Columns.ColumnWidth = 27.11
ActiveWindow.Zoom = 85
Else
Columns(5).ColumnWidth = 3.78
'ActiveWindow.Zoom = 75
End If

I would like to be able to change the values zoom 85 and 75 to
correspond to the values in 2 cells, for eample, Notes!B5 and Notes!
B6, so the zoom factors can be set as needed. How can this be done?

As always,

Thanks,

Tonso


  #4  
Old March 31st, 2010, 03:31 AM posted to microsoft.public.excel.misc
Tonso
external usenet poster
 
Posts: 69
Default vba code to get an duse the value from a particular cell

On Mar 30, 6:47*pm, Gord Dibben gorddibbATshawDOTca wrote:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 Then
* * * *Target.Columns.ColumnWidth = 27.11
* * * *ActiveWindow.Zoom = Sheets("Notes").Range("B5") *'85
* *Else
* * * *Columns(5).ColumnWidth = 3.78
* * * *ActiveWindow.Zoom = Sheets("Notes").Range("B6") *'75
* *End If
End Sub

Gord Dibben *MS Excel MVP

On Tue, 30 Mar 2010 15:26:44 -0700 (PDT), Tonso
wrote:



Using xl2003, I have the following Worksheet Selection Change code:


If Target.Column = 5 Then
* * * Target.Columns.ColumnWidth = 27.11
* * * ActiveWindow.Zoom = 85
* Else
* * * Columns(5).ColumnWidth = 3.78
* * * 'ActiveWindow.Zoom = 75
* End If


I would like to be able to change the values zoom 85 and 75 to
correspond to the values in 2 cells, for eample, Notes!B5 and Notes!
B6, so the zoom factors can be set as needed. How can this be done?


As always,


Thanks,


Tonso- Hide quoted text -


- Show quoted text -


As always, Thanks so much Gord

Tonso
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:46 PM.


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