+ Reply to Thread
Results 1 to 3 of 3

not allowing invalid date in combobox

Hybrid View

  1. #1
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    not allowing invalid date in combobox

    hello i have a userform with 3 comboboxes, one with the year one with month and one with date. There is a command button at the end. I want the command button to look at the month and date the use rhas selected and recognise if date is invalid eg. 30th. I know how to check for 1 box (if combobox2.value=Feb Then_ MsgBox....) but i dont know how to say, if combobox one has feb and combobox 2 has 30 then msgbox....

    Any thoughts?

    Many Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: not allowing invalid date in combobox

    Something like this perhaps, change the control names of course.
    If Not IsDate(Join(Array(cmbDay.Value, cmbMonth.Value, cmbYear.Value), " ")) Then
        MsgBox "Invalid date entered"
        Exit Sub
    End If
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: not allowing invalid date in combobox

    Thankyou Norie it worked!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] userform invalid property value only on certain items in combobox
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 06:30 AM
  2. Data Validation allowing invalid entries
    By Simon1185 in forum Excel General
    Replies: 7
    Last Post: 10-19-2010, 09:15 AM
  3. Macro allowing Tab key in ComboBox - requires extra keypress?
    By dcunneen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-17-2010, 08:49 PM
  4. Combobox returning invalid property error
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2009, 05:24 AM
  5. Equal sign not allowing a Date
    By skhammonds in forum Excel General
    Replies: 2
    Last Post: 11-14-2007, 07:48 PM

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