Dynamic scroll area

N

Noslien

I want to be able to change the size of the scroll area on a work sheet
when I run a macro. The problem is that the format for doing this is

Worksheets("Sheet2").ScrollArea = "A1:B2"

where "A1:B2" has to be a string, however i will be calculating the
range in the VB macro so it will be in the form of
Ranges(cells(a,b),cells(x,y)) - where a,b,x & y are calculated - and
this is not a string. How can I solve this??

Grateful for any help
 
D

Don Guillett

use this idea for this AND you can use for printarea as well

Sub setscrollareabyaddress()
Set myscrollarea = Range(Cells(1, 1), Cells(5, 12))
Worksheets("Sheet7").ScrollArea = myscrollarea.Address '"A1:B2"

End Sub
 
A

Ardus Petus

"Noslien" <[email protected]> a écrit
dans le message de
I want to be able to change the size of the scroll area on a work sheet
when I run a macro. The problem is that the format for doing this is

Worksheets("Sheet2").ScrollArea = "A1:B2"

where "A1:B2" has to be a string, however i will be calculating the
range in the VB macro so it will be in the form of
Ranges(cells(a,b),cells(x,y)) - where a,b,x & y are calculated - and
this is not a string. How can I solve this??

Grateful for any help
Worksheets("Sheet2").ScrollArea = Range(cells(a,b),cells(x,y)).Address

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top