+ Reply to Thread
Results 1 to 2 of 2

Solving a simple if..then statement

  1. #1
    Registered User
    Join Date
    05-24-2010
    Location
    Rutherfordton, NC
    MS-Off Ver
    Excel 2007
    Posts
    39

    Question Solving a simple if..then statement

    I have quite a long program which is running, but I am trying to add one seemingly trivial section. I am not getting the right results, and I think it is something to do with the way in which I am setting up my if...then statement. I am novel to VBA, so I'm probably missing something simple. I'll post the code here.

    Please Login or Register  to view this content.
    sMoveIn and sRBeginDate are dates, but they are dim'ed as strings. Is that a problem? Is there a way to declare a variable as a date?
    Jordan Kidd

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Solving a simple if..then statement

    Yes, you can dim a variables as a date:

    Please Login or Register  to view this content.
    It might help here, as doing a numeric > comparison against a string value (as you are in your nested If statement) is inviting unexpected results.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1