VBA code for going to top of Page 2

sagain2k

Board Regular
Joined
Sep 8, 2002
Messages
94
I have VBA code automatically creating 3 charts on a sheet, but the number of data series for each chart can vary which effects the size of the charts. So I need to be able to place a chart on Page 2 depending on the number of data series the charts have.

How do I specifify in VBA to go to (select) the cell that is the top of page 2 in the active worksheet? My code to position the chart looks like this at the moment:

With ThisChart
With .Parent
.Top = Range("A2").Top
.Left = Range("A2").Left
.Name = "IEPChart"
.Width = 500
.Height = 200
End With
End With

When needed, I'd like to be able to specify the range to be the first cell in column A of Page 2 of the active worksheet. Any suggestions on code that would do this? Thanks!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Juan...thanks for the response. No, what I'm looking for is how to specify the first cell in Column A of Page 2 on the SAME worksheet. For example, I can go to cell A1, then press the PageDown key and it takes me to that cell...but I want to be able to specify that in VBA code...can't quite get it. I tried SendKeys ("{PGDN}") but that didn't work...
 
Upvote 0
Then how about this ?

ActiveWindow.LargeScroll 1

that does NOT select the cell, just moves the screen one page down.

To select the first visible cell, you could use

ActiveWindow.VisibleRange(1).Select
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top