Excel compare cells value from different workbooks

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Oldboy
Posts: 19
Joined: 09 Aug 2018, 03:03

Excel compare cells value from different workbooks

09 Aug 2018, 03:19

Hi, I've search a lot, but I'cant find the way to compare the values of cells located in different workbooks in Excel.
What I need is a string to resolve this: "If the value of current cell in workbook1 is equal to the value of current cell in workbook2 do this..."
I think that I can't handle different workbooks, but maybe there is a way to compare the value of the cells.
Thanks
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Excel compare cells value from different workbooks

09 Aug 2018, 15:51

You could have two COM objects that have each one of the excel files open. Then you can compare cells.
Or you insert a formula in Excel to compare the cells, then you do not even need AHK.
ciao
toralf
Oldboy
Posts: 19
Joined: 09 Aug 2018, 03:03

Re: Excel compare cells value from different workbooks

17 Aug 2018, 01:14

Thanks toralf
toralf wrote:You could have two COM objects that have each one of the excel files open. Then you can compare cells.
Yes, I know, but i need an action if the cells value are equal, so i prefer to use AHK directly.
toralf wrote:You could have two COM objects that have each one of the excel files open. Then you can compare cells.
I've tried to make a test with every COM (active, get, exc..), but I'm not able to handle two files, it remind me always an error on the second files.

oWorkbook:= ComObjActive("D:\TEST_A.xls")
oWorkbook.Sheets("Menu").Select
sleep, 200
oWorkbook1:= ComObjGet("D:\TEST_B.xls")
oWorkbook1.Sheets("Log").Select

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 155 guests