ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programming equiv. of <Ctrl <Home (https://www.excelbanter.com/excel-programming/347473-programming-equiv-ctrl-home.html)

cawatson

Programming equiv. of <Ctrl <Home
 
On a sheet, executing <Ctrl <Home moves the cursor to the top/left corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?

Tushar Mehta

Programming equiv. of <Ctrl <Home
 
In article ,
says...
On a sheet, executing <Ctrl <Home moves the cursor to the top/left corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?

Don't know if this will help, but what happens if you turn on the macro
recorder (Tools | Macro Record new macro...) and use the UI to carry
out a CTRL HOME?

Remember to turn off the recorder.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

Tom Ogilvy

Programming equiv. of <Ctrl <Home
 
Sub CtrlHome()
Application.Goto Range("A1"), True
ActiveWindow.VisibleRange(1, 1).Select
End Sub

--
Regards,
Tom Ogilvy


"cawatson" wrote in message
...
On a sheet, executing <Ctrl <Home moves the cursor to the top/left

corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?




cawatson

Programming equiv. of <Ctrl <Home
 
Tushar,

I appreciate your response but using the macro recorder does not work
because it creates a hard coded cell reference... This fails if the macro
"hides" that particular column on a subsequent running.

"Tushar Mehta" wrote:

In article ,
says...
On a sheet, executing <Ctrl <Home moves the cursor to the top/left corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?

Don't know if this will help, but what happens if you turn on the macro
recorder (Tools | Macro Record new macro...) and use the UI to carry
out a CTRL HOME?

Remember to turn off the recorder.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions


Kleev

Programming equiv. of <Ctrl <Home
 
I guess I shouldn't have doubted you. I did not think this would do what the
OP was requesting as I thought it would goto cell A1. But I tested it and
sure enough it did work.

"Tom Ogilvy" wrote:

Sub CtrlHome()
Application.Goto Range("A1"), True
ActiveWindow.VisibleRange(1, 1).Select
End Sub

--
Regards,
Tom Ogilvy


"cawatson" wrote in message
...
On a sheet, executing <Ctrl <Home moves the cursor to the top/left

corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?





cawatson

Programming equiv. of <Ctrl <Home
 
Tom,

Thanks... Your suggestion has me about 95%+ there but...

As written, this does in fact take me to the top/left of the "unfrozen"
window but, unlike the <Ctrl<Home keystroke combo does not take into acount
hidden columns (e.g. top/left of unfrozen area is D11 but macro has columns D
thru G hidden; <Ctrl<Home goes to H11 but code goes to D11)

Any thoughts?

-Carl

"Tom Ogilvy" wrote:

Sub CtrlHome()
Application.Goto Range("A1"), True
ActiveWindow.VisibleRange(1, 1).Select
End Sub

--
Regards,
Tom Ogilvy


"cawatson" wrote in message
...
On a sheet, executing <Ctrl <Home moves the cursor to the top/left

corner
of the "unfrozen" window (not just the displayed window) regardless of
horiz/vert scroll positions.

Anyone know how to code the same movement?






All times are GMT +1. The time now is 12:24 AM.

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