View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default ScrollArea : How I can do that

ElseIf x = 5 Then
ActiveSheet.ScrollArea = "D6:D10"


One idea...

Sub Demo()
Dim x As Long
Dim R As Long, C As Long
x = 5 ' <- Your number
ActiveSheet.ScrollArea = Range("D6").Resize(x).Address
'or
R = 3
C = 4
ActiveSheet.ScrollArea = Cells(R, C).Resize(x).Address
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Excel 2007


"Gief Hell" wrote in message
...
Hello

I have many condition to evaluate the scrollArea, how I can do that in
one line


If x = 3 Then
ActiveSheet.ScrollArea = "D6:D8"
ElseIf x = 4 Then
ActiveSheet.ScrollArea = "D6:D9"
ElseIf x = 5 Then
ActiveSheet.ScrollArea = "D6:D10"

ElseIf ....
....
End If

Like ...

Dim j, k
J = 6 ' row
K = 4 ' col

ActiveSheet.ScrollArea = " k,j: k,j+x"

I don't have any idea to write the good instruction for the ScrollArea

You can help me

Thanks

Gief