Please help!
I'm trying to set a variable dependent on some input by the user. The user inputs 2 different times; and also selects the date. I need the code to compare these times based on "within an hour AND same day", "outside an hour" AND same day", and "Not same day". It's currently not working, but i'm not sure as to why. Thanks in advance!
This is what i have so far:
dim day, timeC, timeR, timeA as string
dim nextrow as long
day = Format(TextBox2.Text, "mm dd yy")
timeC = Format(TextBox1.Text, "hh:mm")
timeR = Format(TextBox11.Text, "hh:mm")
If timeR < DateAdd("h", 1, timeC) And day = Date Then
nextrow = Sheets("tracking").Cells(Rows.Count, "A").End(xlUp).End(xlUp).Row + 1
If timeA = 1 Then
I'm trying to set a variable dependent on some input by the user. The user inputs 2 different times; and also selects the date. I need the code to compare these times based on "within an hour AND same day", "outside an hour" AND same day", and "Not same day". It's currently not working, but i'm not sure as to why. Thanks in advance!
This is what i have so far:
dim day, timeC, timeR, timeA as string
dim nextrow as long
day = Format(TextBox2.Text, "mm dd yy")
timeC = Format(TextBox1.Text, "hh:mm")
timeR = Format(TextBox11.Text, "hh:mm")
If timeR < DateAdd("h", 1, timeC) And day = Date Then
timeA = 1
ElseIf timeR > DateAdd("h", 1, timeC) And day = Date ThentimeA = 2
ElseIf day <> Format(Date, "mm dd yy") ThentimeA = 3
End Ifnextrow = Sheets("tracking").Cells(Rows.Count, "A").End(xlUp).End(xlUp).Row + 1
If timeA = 1 Then
Sheets("tracking").Range("BA" & nextrow) = 1
ElseIf timeA = 2 ThenSheets("tracking").Range("BB" & nextrow) = 1
ElseIf timeA = 3 thenSheets("tracking").Range("BC" & nextrow) = 1
End If