ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set TIME condition for if-statement? (https://www.excelbanter.com/excel-programming/440854-how-set-time-condition-if-statement.html)

Eric

How to set TIME condition for if-statement?
 
I would like to process following code if time is between 12:30PM and 2:30PM.
Does anyone have any suggestions on how to code this if-statement in VBA
coding for Excel's macro?
Thanks in advance for any suggestions
Eric

if time is between 12:30PM and 2:30PM then
(
Coding
);

JLGWhiz[_2_]

How to set TIME condition for if-statement?
 
If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
'rest of code

End If

"Eric" wrote in message
...
I would like to process following code if time is between 12:30PM and
2:30PM.
Does anyone have any suggestions on how to code this if-statement in VBA
coding for Excel's macro?
Thanks in advance for any suggestions
Eric

if time is between 12:30PM and 2:30PM then
(
Coding
);




Eric

How to set TIME condition for if-statement?
 
There is an error related to if-statement, missing ":",
could you please tell me the format on using if statement
If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
(
Coding);
End if

Will it be the right format?
Thanks in advance for any suggestions
Eric

"JLGWhiz" wrote:

If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
'rest of code

End If

"Eric" wrote in message
...
I would like to process following code if time is between 12:30PM and
2:30PM.
Does anyone have any suggestions on how to code this if-statement in VBA
coding for Excel's macro?
Thanks in advance for any suggestions
Eric

if time is between 12:30PM and 2:30PM then
(
Coding
);



.


JLGWhiz[_2_]

How to set TIME condition for if-statement?
 
The statement works, as is, in VBA. Not familiar with use in other code
structure.


"Eric" wrote in message
...
There is an error related to if-statement, missing ":",
could you please tell me the format on using if statement
If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
(
Coding);
End if

Will it be the right format?
Thanks in advance for any suggestions
Eric

"JLGWhiz" wrote:

If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
'rest of code

End If

"Eric" wrote in message
...
I would like to process following code if time is between 12:30PM and
2:30PM.
Does anyone have any suggestions on how to code this if-statement in
VBA
coding for Excel's macro?
Thanks in advance for any suggestions
Eric

if time is between 12:30PM and 2:30PM then
(
Coding
);



.




Rick Rothstein

How to set TIME condition for if-statement?
 
Your original message said you were looking for a VBA solution, so I'm not
sure why you are showing us pseudo-code snippets that use parentheses as
code-block delimiters... are you really using VBA? The code JLGWhiz posted
works correctly in VBA. If you are using VBA, but still got the error you
are indicating, then did you copy/paste JLGWhiz's code or did you type it
into your program and change some aspect of it? Also, if using VBA, exactly
when did that error message appear to you and exactly what code was
highlighted (copy/paste your code into your reply so we can see it, don't
retype it for us as you may inadvertently correct the error when doing so)?

--
Rick (MVP - Excel)



"Eric" wrote in message
...
There is an error related to if-statement, missing ":",
could you please tell me the format on using if statement
If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
(
Coding);
End if

Will it be the right format?
Thanks in advance for any suggestions
Eric

"JLGWhiz" wrote:

If Time #12:30:00 PM# And Time < #2:30:00 PM# Then
'rest of code

End If

"Eric" wrote in message
...
I would like to process following code if time is between 12:30PM and
2:30PM.
Does anyone have any suggestions on how to code this if-statement in
VBA
coding for Excel's macro?
Thanks in advance for any suggestions
Eric

if time is between 12:30PM and 2:30PM then
(
Coding
);



.



All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com