Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 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
);
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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
);



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 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
);



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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
);



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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
);



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement...And condition Rich D Excel Discussion (Misc queries) 1 January 4th 08 03:50 PM
How to set the time as condition within if statement? Eric Excel Worksheet Functions 2 November 10th 06 01:57 AM
Condition Statement Django Excel Discussion (Misc queries) 5 August 26th 05 06:59 PM
Condition Statement Help?? CWit Excel Programming 7 March 3rd 04 07:16 PM
Condition Statement Stel Excel Programming 4 December 9th 03 12:52 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"