Excel-AHK

Get help with using AutoHotkey and its commands and hotkeys
giselegadot3
Posts: 1
Joined: 24 Jul 2020, 23:53

Excel-AHK

24 Jul 2020, 23:57

Hi guys, newbie to AHK (heard about it from Tom Scott)

im trying to use it in microsoft excel.

in excel using ctrl+pageup or pagedown switches between worksheets. however when i get AHK to use that combination

Send {Ctrl down}PageUp{Ctrl up}

it instead opens format cells

its an up to date version, i am on a laptop (it shares a physical key with the 9 but ctrl+9 only minimises a row

any idea how to get the desired outcome of switching worksheets?

Thanks

[Mod edit: Moved to 'Ask For Help'.]
Last edited by gregster on 26 Jul 2020, 08:23, edited 2 times in total.
Reason: Spam removed.
aifritz
Posts: 260
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: Excel-AHK

25 Jul 2020, 01:22

Didn't tested it, but try:

Code: Select all

Send {Ctrl down}{PageUp}{Ctrl up}
...there may occur a problem, when you're in cell edit mode (F2)
User avatar
Datapoint
Posts: 76
Joined: 18 Mar 2018, 17:06

Re: Excel-AHK

26 Jul 2020, 08:07

Code: Select all

ComObjActive("Excel.Application").ActiveSheet.Next.Activate ; activate next

Code: Select all

ComObjActive("Excel.Application").ActiveSheet.Previous.Activate ; activate prev.

Code: Select all

ComObjActive("Excel.Application").ActiveWorkbook.Worksheets(3).Activate ; activate #3

Code: Select all

ComObjActive("Excel.Application").ActiveWorkbook.Worksheets("Sheet2").Activate ; activate sheet2
User avatar
submeg
Posts: 134
Joined: 14 Apr 2017, 20:39
GitHub: submeg

Re: Excel-AHK

26 Jul 2020, 15:13

aifritz wrote:
25 Jul 2020, 01:22
Didn't tested it, but try:

Code: Select all

Send {Ctrl down}{Pgup}{Ctrl up}
...there may occur a problem, when you're in cell edit mode (F2)
As per @aifritz's comment, this is correct; it is what I use as well; where "Page Up" is written as PgUp.

But, I much prefer @Datapoint's solution of using COM. Where you can, try to learn the COM method, rather than keystroke replication. Right now, I am going through and updating my scripts to shift towards COM, so it's better to avoid rework!
____________________________________
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey :ugeek:

Return to “Ask For Help”

Who is online

Users browsing this forum: djuga, songdg and 29 guests