How to activate specific excel sheet? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guest

How to activate specific excel sheet?  Topic is solved

12 Apr 2015, 13:43

i want to activate sheet2 of current activated excel file. i.e. if current excel file say ABC is opened then i want that when i press hotkey f1 it should always activate sheet2 of ABC excel file...
how it is possible via com objects...
THANKS
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to activate specific excel sheet?

12 Apr 2015, 13:47

Code: Select all

xl:=ComObjActive("Excel.Application")
xl.Sheets("Sheet2").Select
You can simply create a macro in Excel and check the code that is run when you do things ;)
nik2502
Posts: 4
Joined: 15 Jun 2020, 09:00

Re: How to activate specific excel sheet?

07 Aug 2020, 04:08

HotKeyIt wrote:

Code: Select all

xl:=ComObjActive("Excel.Application")
xl.Sheets("Sheet2").Select
You can simply create a macro in Excel and check the code that is run when you do things ;)
What if the excel file is invisible, How do i select a specific sheet ?
User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to activate specific excel sheet?

07 Aug 2020, 11:06

You can use xl.sheets(2).select or xl.sheets(3).activate. In most cases they are equivalent but you can select multiple sheets and then activate one of them (but not more than 1). You should be able to use select and activate when the Excel is not made visible.
14.3 & 1.3.7

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, DataLife, ShatterCoder and 271 guests