+ Reply to Thread
Results 1 to 6 of 6

Case Select not working

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Case Select not working

    Hi Guys,

    I have a userform from which I choose one of 12 months. Based on the month selected I want to run the following code: This is an extract of the code. My problem is with the second line of code. Please help?
    Thank You


    Please Login or Register  to view this content.
    Last edited by Aland2929; 05-14-2010 at 06:54 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Case Select not working

    Your problem is probably the fact you are using Date as your variable.
    Date is a VBa function (Todays date)

    Try changing Date to myDate or something similar.

    Hope this helps

  3. #3
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Case Select not working

    Quote Originally Posted by Aland2929 View Post
    Hi Guys,

    I have a userform from which I choose one of 12 months. Based on the month selected I want to run the following code: This is an extract of the code. My problem is with the second line of code. Please help?
    Thank You


    Please Login or Register  to view this content.
    There was a spelling mistake which I have corrected. I have change the code but still have a problem with the DateChosen line?
    Please Login or Register  to view this content.
    Thank You

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Case Select not working

    You have changed it to an integer, you need a string

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Case Select not working

    DataChosen has been dimensioned as an Integer where as the select case tests are being made against textual month names
    Cheers
    Andy
    www.andypope.info

  6. #6
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Case Select not working

    Quote Originally Posted by Marcol View Post
    You have changed it to an integer, you need a string

    Please Login or Register  to view this content.
    Thanks Andy. It works fine now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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