W
WLMPilot
I use a userform to obtain info about clocking in/out at work. This is a
simple user entry userform. Fields are Textbox2 (clock-in) and Textbox3
(clock-out). Time is entered based on 24-hr clock using colon, ie 17:23
(5:23pm).
I want to calculate total hours worked. Thus, I need to subtract, then
convert to hours. I am able to do this in a spreadsheet using HOURS() and
MINUTE(). However, I cannot get it to work in a macro. Here is an example
of what I need to happen as I have it in the spreadsheet (but using macro
fields). I need to perform same calculation in a macro.
User enters: Textbox2 = 8:00 Textbox3 = 17:23
Calculations after user clicks ENTER:
ttltime1 = Textbox3 - Textbox3 (should = 9:23)
ttltime2 = HOURS(ttltime1) +(MINUTE(ttltime1)/60) (should = 9.38)
ttltime2 will then be inserted into the spreadsheet.
I also need to know how to DIM all the fields.
Thanks in advance,
Les
simple user entry userform. Fields are Textbox2 (clock-in) and Textbox3
(clock-out). Time is entered based on 24-hr clock using colon, ie 17:23
(5:23pm).
I want to calculate total hours worked. Thus, I need to subtract, then
convert to hours. I am able to do this in a spreadsheet using HOURS() and
MINUTE(). However, I cannot get it to work in a macro. Here is an example
of what I need to happen as I have it in the spreadsheet (but using macro
fields). I need to perform same calculation in a macro.
User enters: Textbox2 = 8:00 Textbox3 = 17:23
Calculations after user clicks ENTER:
ttltime1 = Textbox3 - Textbox3 (should = 9:23)
ttltime2 = HOURS(ttltime1) +(MINUTE(ttltime1)/60) (should = 9.38)
ttltime2 will then be inserted into the spreadsheet.
I also need to know how to DIM all the fields.
Thanks in advance,
Les