Greetings Everybody!
At another Excel forum I had posted a thread regarding a problem I had using
the Time() function in Excel 2003 (our office just recently upgraded, which
is causing me to have to re-write all of my macros...grr). I was advised to
change the code to use the Format function in conjunction with the now()
function instead, which worked, for a little while. Now it's not working
again, and the reason has something to do with the TIME reference. The first
time I run the macro after opening the spreadsheet, it won't work, and I get
an error that highlights the following code :
RightNow = Format(Now(), "Hh")
(RightNow is a variable declared at the beginning of the macro). If I move
the TIME reference up or down, any amount of spaces, on the references table,
and then rerun the macro, it works PERFECTLY. No errors, no problems, nothing.
This has me perplexed, because if I close the file down, and open in again,
the SAME thing happens. Doesn't work the first time, then if I move the TIME
reference at all, in any direction, it works just fine.
How do I fix this so it works all the time, without having to move the
reference every time I want to run the macro??
At another Excel forum I had posted a thread regarding a problem I had using
the Time() function in Excel 2003 (our office just recently upgraded, which
is causing me to have to re-write all of my macros...grr). I was advised to
change the code to use the Format function in conjunction with the now()
function instead, which worked, for a little while. Now it's not working
again, and the reason has something to do with the TIME reference. The first
time I run the macro after opening the spreadsheet, it won't work, and I get
an error that highlights the following code :
RightNow = Format(Now(), "Hh")
(RightNow is a variable declared at the beginning of the macro). If I move
the TIME reference up or down, any amount of spaces, on the references table,
and then rerun the macro, it works PERFECTLY. No errors, no problems, nothing.
This has me perplexed, because if I close the file down, and open in again,
the SAME thing happens. Doesn't work the first time, then if I move the TIME
reference at all, in any direction, it works just fine.
How do I fix this so it works all the time, without having to move the
reference every time I want to run the macro??