Find cell, copy adjacent cell ComObj

Get help with using AutoHotkey and its commands and hotkeys
Trigg
Posts: 90
Joined: 07 Apr 2017, 19:43

Find cell, copy adjacent cell ComObj

19 May 2017, 15:32

I want to convert old invoice numbers (in column A) to new ones with a MASSIVE range of rows. Then after I find the cell with the old invoice number the converted number is adjacent to it (column B).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: Find cell, copy adjacent cell ComObj

19 May 2017, 15:47

Remove this line: XL.Sheets("AC to IC Claim Numbers").Select
Then:
MyCell := XL.Sheets("sheet2").Range("A:A").Find(Claim) You can use the exact sheet name, ex: .Sheets("AC to IC Claim Numbers") or .Sheets("sheet2"), or you can use the sheet number, ex: .Sheets(2)
and then
Conversion := MyCell.offset(0, 1).text


Edit:
Conversion := XL.Sheets("Sheet2").Range("A:A").Find(Claim).Offset(0, 1).Text
Trigg
Posts: 90
Joined: 07 Apr 2017, 19:43

Re: Find cell, copy adjacent cell ComObj

22 May 2017, 09:33

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I'm trying to figure out if the claim number has not been converted to quit excel. But my script is still converting the clipboard to my Conversion variable.
IMEime
Posts: 411
Joined: 20 Sep 2014, 06:15

Re: Find cell, copy adjacent cell ComObj

22 May 2017, 09:57

I'm not sure though, is "ErrorLevel" correct one ? How about "MyCell" instead.
kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: Find cell, copy adjacent cell ComObj

22 May 2017, 10:26

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Untested, but try something like this.
Use the Excel object browser to search for the values of constants (like xlWhole ).
HTH :)
Last edited by kon on 22 May 2017, 10:38, edited 1 time in total.
Trigg
Posts: 90
Joined: 07 Apr 2017, 19:43

Re: Find cell, copy adjacent cell ComObj

22 May 2017, 10:33

IMEime wrote:I'm not sure though, is "ErrorLevel" correct one ? How about "MyCell" instead.


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



This works. If MyCell var does not have value then the script ends. Thank you.
IMEime
Posts: 411
Joined: 20 Sep 2014, 06:15

Re: Find cell, copy adjacent cell ComObj

22 May 2017, 10:38

Good

You could use just

Code: [Select all] [Download] GeSHi © Codebox Plus

If myVar ; only this case

And If you want quit.

Code: [Select all] [Download] GeSHi © Codebox Plus

myObj.Quit  ; also, it's my two step habit just for Excel. I do not know quit function in this case.
myObj =

Return to “Ask For Help”

Who is online

Users browsing this forum: A_AhkUser, Bing [Bot], Exaskryz, Exequiel3k, KrycerKris, Mateus Campello, newbieforever, rdllngr, Yahoo [Bot] and 38 guests