| | |
Multiple "OR" process
![]() |
•
•
Join Date: Nov 2007
Posts: 14
Reputation:
Solved Threads: 0
Hello,
I'm a newbie at VB and am trying to get some help with a process. My code will check an Excel file for dates and store them in a number of variables. Then I want to be able to compare those dates to the current date. I was thinking about using "Case", but is there a smoother, better way to do this? What I want is to basically say, "If any of these dates meet the criteria, then do something."
Thanks,
Mark
I'm a newbie at VB and am trying to get some help with a process. My code will check an Excel file for dates and store them in a number of variables. Then I want to be able to compare those dates to the current date. I was thinking about using "Case", but is there a smoother, better way to do this? What I want is to basically say, "If any of these dates meet the criteria, then do something."
Thanks,
Mark
Hi
You can use DateDiff Function to Compare dates
Interval may be
yyyy -- Year
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second
Example
You can use DateDiff Function to Compare dates
DateDiff(interval, date1, date2) Interval may be
yyyy -- Year
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second
Example
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim TheDate As Date ' Declare variables. Dim Msg as String TheDate = InputBox("Enter a date") Msg = "Days from today: " & DateDiff("d", Now, TheDate) MsgBox Msg
Last edited by selvaganapathy; May 12th, 2008 at 1:46 pm.
KSG
![]() |
Similar Threads
- spydoctor? (Viruses, Spyware and other Nasties)
- "each new axis love", "bodyplatformplatform" and "modefrag error" (Viruses, Spyware and other Nasties)
- Help me " Ticket Reservation System" (C++)
- "Forbidden / You don't have permission to access / on this server." error (Linux Servers and Apache)
- problems with Windows 2000 professional. "Systemced" error msg (Windows NT / 2000 / XP)
- Help - surf sidekick 3 is attacking! (Viruses, Spyware and other Nasties)
- "topantispyware" virus (Viruses, Spyware and other Nasties)
- "Home Search 'Assistent'"... yet again (Viruses, Spyware and other Nasties)
- more "home search assistent" fun... (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Extracting a zip file.
- Next Thread: Sendtoback problem
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





