Excel COM - Select cell under current active cell

Get help with using AutoHotkey and its commands and hotkeys
harpo

Excel COM - Select cell under current active cell

20 Apr 2017, 19:31

Ok, so. First time poster but I Love AHK, been using it alot the last year and gotten lots of work done.

Anyhow. Ive started using COM to work with Excel, but Im still pretty stupid about it.

I know I can select a cell with for example:
XL.Range("B2").Select

But how do I give the select function the current cell, +1 in row? So say I have B2 selected, I want to select B3. Or if D10 is currently selected, I want to select D11.
I dont understand how to pass the current cell information into the Range().Select function.

I want to do something like XL.Range(CurrentCellRow+1).Select

Thanks.
kon
Posts: 1720
Joined: 29 Sep 2013, 17:11

Re: Excel COM - Select cell under current active cell

20 Apr 2017, 19:56

Hi :wave:

Here's a link to a recent topic that is almost identical. It moves the selection one to the right, but going one down would be similar. (Use .Offset(1, 0) instead of .Offset(0, 1).)

More related links:
Obumbration
Posts: 2
Joined: 20 Apr 2017, 19:23

Re: Excel COM - Select cell under current active cell

21 Apr 2017, 07:37

Hi Kon.

Great, got it working now. Thanks.

On an unrelated topic, I need to run the script as administrator. But running the script using COM as administrator causes an error, stupidly enough. You have any idea how to fix this? :o
Obumbration
Posts: 2
Joined: 20 Apr 2017, 19:23

Re: Excel COM - Select cell under current active cell

21 Apr 2017, 08:35

Nevermind.

Running both the script and excel in admin mode seems to be working fine.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Brunoire, Cramos, derz00, johnk4, wideeyedguy, Yahoo [Bot] and 54 guests