Position cursor in multiple worksheets

R

Rick

What code is required in a macro to set the cursor to the
top left or the bottom right in multiple worksheets?
 
T

Tom Ogilvy

Dim sh as Object
Dim Sh1 as Object
set sh1 = Activesheet
for each sh in ActiveWindow.Selectedsheets
sh.Activate
Range("A1").Select
Next
Sh1.Activate


change Range("A1").Select to

cells.SpecialCells(xlCellTypeLastCell).Select

for the bottom right.
 
R

Rick

Hi Tom:

Thanks for your response. I pasted the code into a macro,
but when it is run it positions the cursor in A1 on the
first worksheet only. I have over 35 sheets in the
workboook which I have to do this with.

Rick
 
T

Tom Ogilvy

You said multiple sheets - not all sheets - so I assumed you grouped the
sheets to indicate which ones to do. .

Dim sh as Object
Dim Sh1 as Object
set sh1 = Activesheet
for each sh in ActiveWorkbooks.Worksheets
sh.Activate
Range("A1").Select
Next
Sh1.Activate

Does all sheets.
 
R

Rick

Tom:

I received a "required object" error when running this
code. However; I looked at
the "ActiveWorkbooks.Worksheets" reference and changed it
to "ActiveWorkbook.Worksheets" which seems to work.

No need to respond to this unless the change is incorrect.

Thanks for your help.

Rick
 
Top