Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004

    Unanswered: IF function (Excel VBA)

    Afternoon all,
    I am looking to add an if function (i think) to my report runner in excel. currently it opens an Access database and runs some code but on certain dates (weekends and bank holidays) i want to run a different bit of code in access.
    My question is this a) Can i use a list of dates in VBA i.e
    if Date = "01/01/05","02/01/05 then 'run other code' else 'normal process'

    b) if so how do i separate the dates (i have about 107 of them)

    c) or am i way off the mark and can someone please advise on this.

    Many thanks in advance for any time taken to help.


  2. #2
    Join Date
    Oct 2003
    You can do a Select Case like this:

    Sub test()
        Select Case Weekday(Now)
            Case 1 Or 7
            Case Else
        End Select
    End Sub
    old, slow, and confused
    but at least I'm inconsistent!

    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts