NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,283
- Office Version
- 2016
- 2010
- Platform
- Windows
Good afternoon,
I have a range containing a series of values in hh:mm:ss format.
If any of these durations exceed 10 minutes (the "10" being contained in a worksheet range ThresholdMinutes), I need to extract the minute section of the string and add it to a string variable MyString - this is no problem.
The issue I have is how to define the logic. It needs to be:
IF the minute portion of the string exceeds the value in ThresholdMinutes
OR
IF the minute portion of the value equals ThresholdMinutes AND the second portion of the value is greater then zero
I have the following:
If Mid(MyCell, 4, 2) > ThresholdMinutes Or Mid(MyCell, 4, 2) = ThresholdMinutes And Mid(MyCell, 7, 2) > 0)) Then
MyString= MyString ", " & Mid MyCell(4,2)
End If
but it doesn't work - the first line is highlighted red, due to my poor IF AND logic - can anyone help out, please?
Thanks in advance
Pete
I have a range containing a series of values in hh:mm:ss format.
If any of these durations exceed 10 minutes (the "10" being contained in a worksheet range ThresholdMinutes), I need to extract the minute section of the string and add it to a string variable MyString - this is no problem.
The issue I have is how to define the logic. It needs to be:
IF the minute portion of the string exceeds the value in ThresholdMinutes
OR
IF the minute portion of the value equals ThresholdMinutes AND the second portion of the value is greater then zero
I have the following:
If Mid(MyCell, 4, 2) > ThresholdMinutes Or Mid(MyCell, 4, 2) = ThresholdMinutes And Mid(MyCell, 7, 2) > 0)) Then
MyString= MyString ", " & Mid MyCell(4,2)
End If
but it doesn't work - the first line is highlighted red, due to my poor IF AND logic - can anyone help out, please?
Thanks in advance
Pete
Last edited: