ActiveCell.value+1 not worked if cell is date.

Get help with using AutoHotkey and its commands and hotkeys
hyaray
Posts: 21
Joined: 20 Jun 2015, 01:37

ActiveCell.value+1 not worked if cell is date.

13 Apr 2019, 22:27

in ahk, "xl.ActiveCell.Value := xl.ActiveCell.Value + 1" not worked if cell is date.
in VBE, "activeCell = activeCell + 1" can deal both num and date.
so is Ahk has a similar simple method can deal both number and date?? :xmas: :xmas:
I see xl.ActiveCell.Value(11) has mor info By XML,
I don't know is neccessary to deal XML and how to do :crazy:
Thanks very much!!!
Odlanir
Posts: 521
Joined: 20 Oct 2016, 08:20

Re: ActiveCell.value+1 not worked if cell is date.

14 Apr 2019, 04:40

This works for me:

Code: Select all

oExcel.ActiveCell.NumberFormat := "########"
oExcel.ActiveCell.value := oExcel.ActiveCell.value + 1
oExcel.ActiveCell.NumberFormat := "gg/MM/aaaa"  ; European date
;~ or
;~ oExcel.ActiveCell.NumberFormat := "MM/dd/yyyy" ; USA date ( I think )
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Klarion
Posts: 176
Joined: 26 Mar 2019, 10:02

Re: ActiveCell.value+1 not worked if cell is date.

14 Apr 2019, 05:16

How about to use CDate function of VBA ? though I have never used it at AHK
hyaray
Posts: 21
Joined: 20 Jun 2015, 01:37

Re: ActiveCell.value+1 not worked if cell is date.

14 Apr 2019, 11:22

Odlanir wrote:
14 Apr 2019, 04:40
This works for me:

Code: Select all

oExcel.ActiveCell.NumberFormat := "########"
oExcel.ActiveCell.value := oExcel.ActiveCell.value + 1
oExcel.ActiveCell.NumberFormat := "gg/MM/aaaa"  ; European date
;~ or
;~ oExcel.ActiveCell.NumberFormat := "MM/dd/yyyy" ; USA date ( I think )
this can work well for date, thanks!! :xmas: :xmas:

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], eL Tux, flyingDman, viceversa, x-tremespeed and 218 guests