Dynamic scroll area

  • Thread starter Thread starter Noslien
  • Start date Start date
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
 
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
 
"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
 
Back
Top