Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
GarryH
 
Posts: n/a
Default How can I get a macro in Excel to set the Zoom to "Selection"?

I have created a Workbook_Open macro that selects a range and zoom, but the
macro only records the setting on the PC that it was created on, i.e 100%.
Can this 100 be changed within the macro to make use of the Selection option
in zoom so that it will work on other PC's with different screen
sizes/resolutions?
  #2   Report Post  
Paul B
 
Posts: n/a
Default

Garry, here is one way

Range("A1:AL25").Select
ActiveWindow.Zoom = True
Range("A1").Select

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"GarryH" wrote in message
...
I have created a Workbook_Open macro that selects a range and zoom, but the
macro only records the setting on the PC that it was created on, i.e 100%.
Can this 100 be changed within the macro to make use of the Selection
option
in zoom so that it will work on other PC's with different screen
sizes/resolutions?



  #3   Report Post  
Don Guillett
 
Posts: n/a
Default

This is one I did for a customer where one used 800x600 and another used
1028. It involved using the same defined name but with different selected
areas for each worksheet. Goes in the ThisWorkbook module

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

Dim tstRange As Range
Dim curWks As Worksheet
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks
If wks.Name < "xxx" And wks.Name < "yyy" Then
Set tstRange = Nothing
On Error Resume Next
Set tstRange = .Range("myzoom")
On Error GoTo 0
If tstRange Is Nothing Then
'do nothing
Else
.Select
tstRange.Select
ActiveWindow.Zoom = True
.Range("a1").Select
End If
End If
End With

Next wks
Sheets("zzzz").Select
Application.ScreenUpdating = True

Application.Calculation = xlCalculationAutomatic

End Sub


--
Don Guillett
SalesAid Software

"GarryH" wrote in message
...
I have created a Workbook_Open macro that selects a range and zoom, but

the
macro only records the setting on the PC that it was created on, i.e 100%.
Can this 100 be changed within the macro to make use of the Selection

option
in zoom so that it will work on other PC's with different screen
sizes/resolutions?



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
Assign Macro to button in Excel doesnt work Any ideas? Mike@Becketts Excel Discussion (Misc queries) 2 December 20th 04 02:47 PM
Macro not working with Excel 2003 Fernando Gomez Excel Discussion (Misc queries) 1 December 16th 04 12:19 AM
Do macro shortcuts interfere with excel hotkeys? Devaryeh Excel Discussion (Misc queries) 2 December 15th 04 10:47 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM
Excel Macro Danny Excel Discussion (Misc queries) 6 December 8th 04 07:11 PM


All times are GMT +1. The time now is 01:41 PM.

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

About Us

"It's about Microsoft Excel"