counting the row of certain column in excel Topic is solved

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

counting the row of certain column in excel

19 Apr 2018, 21:55

Hello guys, i been trying to get the total number of row in, for example column B in excel, but i am not sure how to allow autohotkey to get the total count in column B, this is my code so far.

Code: Select all

Z::
File = Book1.xlsx
path = %A_WorkingDir%\%File% ; path to workbook 
xl := ComObjGet(path) ; access Workbook object

(Sheet := xl.ActiveSheet).Range("A1:A50")
hello := Sheet.Range("A1", Sheet.Cells(xl.Application.Rows.Count,5).End(-4162)).SpecialCells(12).Count
MsgBox, % hello

User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: counting the row of certain column in excel

19 Apr 2018, 22:33

Try this. Cheers.

Code: Select all

q:: ;excel - get row number for last cell in column
oXl := ComObjCreate("Excel.Application")
oXl.Visible := -1 ;True
oXl.Workbooks.Add
oXl.Range("E10").Value := "x"
xlUp := -4162
vCol := 5
vRow := oXl.Cells(oXl.Rows.Count, vCol).End(xlUp).Row
vAddress := oXl.Cells(oXl.Rows.Count, vCol).End(xlUp).Address(0, 0)
MsgBox, % vRow " " vAddress
oXl := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
mdmc
Posts: 1
Joined: 04 Jul 2019, 08:55

Re: counting the row of certain column in excel

04 Jul 2019, 09:16

jeeswg wrote:
19 Apr 2018, 22:33
Try this. Cheers.

Code: Select all

q:: ;excel - get row number for last cell in column
oXl := ComObjCreate("Excel.Application")
oXl.Visible := -1 ;True
oXl.Workbooks.Add
oXl.Range("E10").Value := "x"
xlUp := -4162
vCol := 5
vRow := oXl.Cells(oXl.Rows.Count, vCol).End(xlUp).Row
vAddress := oXl.Cells(oXl.Rows.Count, vCol).End(xlUp).Address(0, 0)
MsgBox, % vRow " " vAddress
oXl := ""
return
Hello,
I'm just starting to grow up on this program, but I want to know. we solve a similar problem.
But I couldn't fully understand the code it was writing. Can you help me?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1, penguinautomator, Spawnova and 252 guests