[MS.Excel] Determine how many cells contain values Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

[MS.Excel] Determine how many cells contain values

Post by HiSoKa » 27 Jun 2022, 08:46

Hello, I have a large number of CELL contain values in the column.
I want to put the number of these fields in the clipboard so that I can deal with this number later,
Such as writing something on the first CELL after this number ... and so on.

For example,
I have column A and all the cells Between 1 and 150 contain something (Number or text).
I want to put the number 150 in the clipboard so that I can write asomething later on the field 150 + 1..

I Hope my question is clear, thank you

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: [MS.Excel] Determine how many cells contain values  Topic is solved

Post by flyingDman » 27 Jun 2022, 09:26

There are several ways to determine the last row. This is one:

Code: Select all

xl := ComObjActive("excel.application")
lstrw := xl.Range("A" xl.Rows.Count).End(-4162).Row
msgbox % lstrw
So this will return 5 even though cell 3 is blank:
20220627_072841.jpg
20220627_072841.jpg (2.48 KiB) Viewed 488 times
14.3 & 1.3.7

User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Re: [MS.Excel] Determine how many cells contain values

Post by HiSoKa » 27 Jun 2022, 09:42

I try it i got blank MsgBox Should it give me "2" write on (A3) or (A6), Right?
Untitleds.png
Untitleds.png (134.8 KiB) Viewed 476 times

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: [MS.Excel] Determine how many cells contain values

Post by flyingDman » 27 Jun 2022, 09:54

The message box should show 5 which is the last row.
14.3 & 1.3.7

User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Re: [MS.Excel] Determine how many cells contain values

Post by HiSoKa » 27 Jun 2022, 10:11

I don't know why MsgBox is empty.
i have AHK 1.1.33.10

User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Re: [MS.Excel] Determine how many cells contain values

Post by HiSoKa » 27 Jun 2022, 10:46

It was my fault,
It works as expected now, Thank you very much @flyingDman

Post Reply

Return to “Ask for Help (v1)”