ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Position cursor in multiple worksheets (https://www.excelbanter.com/excel-programming/293416-position-cursor-multiple-worksheets.html)

Rick[_19_]

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

Tom Ogilvy

Position cursor in multiple worksheets
 
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.


--
Regards,
Tom Ogilvy


"Rick" wrote in message
...
What code is required in a macro to set the cursor to the
top left or the bottom right in multiple worksheets?




Rick[_19_]

Position cursor in multiple worksheets
 
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


-----Original Message-----
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.


--
Regards,
Tom Ogilvy


"Rick" wrote in

message
...
What code is required in a macro to set the cursor to

the
top left or the bottom right in multiple worksheets?



.


Tom Ogilvy

Position cursor in multiple worksheets
 
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.

--
Regards,
Tom Ogilvy


"Rick" wrote in message
...
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


-----Original Message-----
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.


--
Regards,
Tom Ogilvy


"Rick" wrote in

message
...
What code is required in a macro to set the cursor to

the
top left or the bottom right in multiple worksheets?



.




Rick[_19_]

Position cursor in multiple worksheets
 
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


-----Original Message-----
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.

--
Regards,
Tom Ogilvy


"Rick" wrote in

message
...
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


-----Original Message-----
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.


--
Regards,
Tom Ogilvy


"Rick" wrote in

message
...
What code is required in a macro to set the cursor

to
the
top left or the bottom right in multiple worksheets?


.



.



All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com