Prevost
Board Regular
- Joined
- Jan 23, 2014
- Messages
- 198
Hi There,
I was wondering how I would go about making condition variables to use in IF statements. The end result of the code is to calculate the total number of hours that a project has been worked on based on a starting time and date and ending time and date. However, there are two breaks and a lunch in a day so those need to be subtracted accordingly. I started to use IF and ELSEIF statements and it is quickly becoming cumbersome to capture all of the IFs (because there are 16 different possibilities for start times and end times and then if it was started on one day and finished the proceeding day and so on..). I know that this is not the actual code, but I think it portrays what I would like to do...
Thanks in advance.
Sub conditions()
Dim condition1 as ?
Dim condition2 as ?
condition1 = between two time values
condition2 = between two time values
If startingtime meets condition1 and condition2 then
[carry out code]
elseif startingtime meets condition1 and condition3 then
[carry out other code]
end if
I was wondering how I would go about making condition variables to use in IF statements. The end result of the code is to calculate the total number of hours that a project has been worked on based on a starting time and date and ending time and date. However, there are two breaks and a lunch in a day so those need to be subtracted accordingly. I started to use IF and ELSEIF statements and it is quickly becoming cumbersome to capture all of the IFs (because there are 16 different possibilities for start times and end times and then if it was started on one day and finished the proceeding day and so on..). I know that this is not the actual code, but I think it portrays what I would like to do...
Thanks in advance.
Sub conditions()
Dim condition1 as ?
Dim condition2 as ?
condition1 = between two time values
condition2 = between two time values
If startingtime meets condition1 and condition2 then
[carry out code]
elseif startingtime meets condition1 and condition3 then
[carry out other code]
end if