Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Set Visible Range

I can detect the visible range in the active worksheet with:

Sub Macro1()
Dim r As Range
Dim s As String
Set r = ActiveWindow.VisibleRange
s = r.Address
MsgBox (s)
End Sub

When, however, I try to setup the visible range with:

Sub Macro2()
Dim s As String
s = "$A$1:Z$100"
ActiveWindow.VisibleRange = Range(s)
End Sub

Nothing happens.

How can I adjust the scrollbars and zoom so that the upper left-hand cell is
A1 and the lower right-hand cell is Z100 using VBA?

Thanks in Advance
--
Gary's Student
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Set Visible Range

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

Excel will do the best it can to meet that - as a minimum, the range will be
visible and at least one constraint will be bounding - but that rectangle
may not meet the dimensions of your computers resolution or the Excel Window
size if your a windowed.

--
Regards,
Tom Ogilvy



"Gary''s Student" wrote in message
...
I can detect the visible range in the active worksheet with:

Sub Macro1()
Dim r As Range
Dim s As String
Set r = ActiveWindow.VisibleRange
s = r.Address
MsgBox (s)
End Sub

When, however, I try to setup the visible range with:

Sub Macro2()
Dim s As String
s = "$A$1:Z$100"
ActiveWindow.VisibleRange = Range(s)
End Sub

Nothing happens.

How can I adjust the scrollbars and zoom so that the upper left-hand cell

is
A1 and the lower right-hand cell is Z100 using VBA?

Thanks in Advance
--
Gary's Student



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Set Visible Range

VisibleRange is a read-only property.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Gary''s Student" wrote in message
...
I can detect the visible range in the active worksheet with:

Sub Macro1()
Dim r As Range
Dim s As String
Set r = ActiveWindow.VisibleRange
s = r.Address
MsgBox (s)
End Sub

When, however, I try to setup the visible range with:

Sub Macro2()
Dim s As String
s = "$A$1:Z$100"
ActiveWindow.VisibleRange = Range(s)
End Sub

Nothing happens.

How can I adjust the scrollbars and zoom so that the upper left-hand cell

is
A1 and the lower right-hand cell is Z100 using VBA?

Thanks in Advance
--
Gary's Student



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Set Visible Range

Thank you Tom
Worked like a charm
--
Gary's Student


"Tom Ogilvy" wrote:

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

Excel will do the best it can to meet that - as a minimum, the range will be
visible and at least one constraint will be bounding - but that rectangle
may not meet the dimensions of your computers resolution or the Excel Window
size if your a windowed.

--
Regards,
Tom Ogilvy



"Gary''s Student" wrote in message
...
I can detect the visible range in the active worksheet with:

Sub Macro1()
Dim r As Range
Dim s As String
Set r = ActiveWindow.VisibleRange
s = r.Address
MsgBox (s)
End Sub

When, however, I try to setup the visible range with:

Sub Macro2()
Dim s As String
s = "$A$1:Z$100"
ActiveWindow.VisibleRange = Range(s)
End Sub

Nothing happens.

How can I adjust the scrollbars and zoom so that the upper left-hand cell

is
A1 and the lower right-hand cell is Z100 using VBA?

Thanks in Advance
--
Gary's Student




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
Sumif for Visible range when using filter anshu[_2_] Excel Discussion (Misc queries) 4 July 20th 07 08:15 AM
Set Range of visible Autofilltered columns VBA? [email protected] Excel Discussion (Misc queries) 6 May 5th 06 03:39 PM
Setting visible range ZipCurs Excel Programming 2 January 5th 06 03:43 AM
SumIf in Visible Cell Range Terri Excel Worksheet Functions 5 October 17th 05 12:12 PM
Sum only visible cells within a range. Jason Kendall Excel Programming 4 July 14th 05 05:18 PM


All times are GMT +1. The time now is 10:06 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"