Excel Entries Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Excel Entries

20 Sep 2021, 09:06

Hello !

This seems to be simple. I am somehow entering the wrong variable when it comes to excel.

Code: Select all

;INI INFO
Global runs, ini, track, end, override
start   := A_TickCount
minutes := 45
end     := start + 1000 * 60 * minutes
ini     := StrReplace(A_ScriptFullPath, ".ahk", ".ini") 
;___________________________________________________________________________________________________________________________________________________________________________________________
;DDL INFO
real    := {"Red John": "John Red", "Blue John": "John Blue", "Green John": "John Green"} ;ACTUAL NAME AS SAVED IN THE PHONE CONTACTS 
Gui, Font, s20 Bold cBlack
Gui, Add, DropDownList, h500 w300 vnick, Red John|Blue John|Green John| ; NAME IN USE
;___________________________________________________________________________________________________________________________________________________________________________________________
;DDL INFO
Gui, Font, s10 Bold cBlack
Gui, Add, Button, Default, Input
OnExit("done")
Show:
Gui, Show
Return

ButtonInput:
Gui, Submit
Gui, Destroy
Sleep, 50

;______________________________________________________________________________________________________________________________________________________________
;INI FILE ENTRIES 

Gosub, Show
track := RegExReplace(nick, "[. ]", "_")
IniRead, year , %ini%, %track%, year
IniRead, month, %ini%, %track%, month
IniRead, runs , %ini%, %track%, runs, 0
If (year != A_YYYY || month != A_MM) {
       IniWrite, %A_YYYY%   , %ini%, %track%, year
       IniWrite, %A_MM%     , %ini%, %track%, month
       IniWrite, % runs := 1, %ini%, %track%, runs
} Else IniWrite, % ++runs   , %ini%, %track%, runs
done(ExitReason := "", ExitCode := "") {
 If !override && A_TickCount < end
  IniWrite, % --runs, %ini%, %track%, runs
}

;Excel

xl := ComObjCreate("excel.application")
wrkbk := xl.workbooks.open("C:\Users\user\Desktop\New Microsoft Excel Worksheet (2).xlsx")


lstrw := xl.Range("B" xl.Rows.Count).End(-4162).Row
mnth := strsplit(xl.Range("C" lstrw).value, "-").2


nwrw := lstrw + 1
nmbr := xl.Range("B" lstrw).value


if nmbr is not number
	nmbr := 0
if (mnth != A_MMM) {
	nmbr := 0
	nwrw++
}


;ENTRIES 


xl.Range("A" nwrw):= "%nick%"
xl.Range("B" nwrw):= "%runs%"
xl.Range("B" nwrw).NumberFormat := "## "
xl.Range("C" nwrw).value := A_DD "-" A_MM "-" A_YYYY
xl.Range("D" nwrw).NumberFormat := "[$-en-US]h:mm Am/Pm;@"
xl.range("D" nwrw).value := A_Hour ":" A_Min ":" A_Sec


wrkbk.close(1)
xl.quit()
In column A I want the variable "nick" to be entered
In column B I want the runs to be entered


Using %runs% and %nick% worked when I tested it with a msgbox

How to make excel enter the name selected from the DDL in column A and the runs in column B

I will be very grateful if anyone can kindly educate me.

Regards.
aifritz
Posts: 301
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: Excel Entries  Topic is solved

20 Sep 2021, 09:18

Code: Select all

xl.Range("A" nwrw).value := nick
xl.Range("B" nwrw).value := runs
Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Re: Excel Entries

20 Sep 2021, 09:21

Thank you !

That worked :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mapcarter and 331 guests