ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scroll Area (https://www.excelbanter.com/excel-programming/310405-scroll-area.html)

Ashman

Scroll Area
 
Is there any way of setting the scroll area of a spread sheet ie: using the
..scrollarea = function in VB where the scroll area may not be known at the
time of writing the vb code.

Instead of using activesheet.scrollarea = "a1:p34"

I want to use activesheet.scrollarea = range1 : where range1 has been
determined

Can this be done?


david mcritchie

Scroll Area
 
instead use:
ActiveSheet.ScrollArea = "range1"
and to remove
ActiveSheet.ScrollArea = ""
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Ashman" wrote in message ...
Is there any way of setting the scroll area of a spread sheet ie: using the
.scrollarea = function in VB where the scroll area may not be known at the
time of writing the vb code.

Instead of using activesheet.scrollarea = "a1:p34"

I want to use activesheet.scrollarea = range1 : where range1 has been
determined

Can this be done?




Ron de Bruin

Scroll Area
 
Hi Ashman

You can use this

Set rng = Range("A4:E10")
ActiveSheet.ScrollArea = rng.Address

Or

Set rng = Range("A1").CurrentRegion
ActiveSheet.ScrollArea = rng.Address


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ashman" wrote in message ...
Is there any way of setting the scroll area of a spread sheet ie: using the
.scrollarea = function in VB where the scroll area may not be known at the
time of writing the vb code.

Instead of using activesheet.scrollarea = "a1:p34"

I want to use activesheet.scrollarea = range1 : where range1 has been
determined

Can this be done?




david mcritchie

Scroll Area
 
A better example: This will toggle between range1 as scroll area
and removing the scroll area limitations on mouse, arrow keys, scrolling, etc.

Private Sub Worksheet_BeforeRightClick(ByVal Target _
As Range, Cancel As Boolean)
Cancel = True
If ActiveSheet.ScrollArea = "" Then
ActiveSheet.ScrollArea = "range1"
Else
ActiveSheet.ScrollArea = ""
End If
End Sub

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com