+ Reply to Thread
Results 1 to 5 of 5

Blank CInt & Cdec textbox values with mismatch

  1. #1
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Blank CInt & Cdec textbox values with mismatch

    Hi all

    I'm having trouble with this If statement as i'm getting "Typemismatch 13" on Textboxes with blank values.

    I have to check all of the Textboxes at once for this to work. Textboxes 1-3 will have whole numeric values "10,000" and Textboxes 4-6 are either decimals or whole numbers "24" or "24.4".

    When one of the textboxes are blank I debug with a typemismatch. Any ideas?

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,303

    Re: Blank CInt & Cdec textbox values with mismatch

    Prefix them with "0":
    Please Login or Register  to view this content.
    and so on.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Blank CInt & Cdec textbox values with mismatch

    Thanks, that has sorted the Debug. What did the "0" trick do?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,303

    Re: Blank CInt & Cdec textbox values with mismatch

    If you have a blank textbox, it gives you just "0" which will work with the coercion functions. If you have an existing value, putting "0" on the start obviously doesn't affect the value.

  5. #5
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Blank CInt & Cdec textbox values with mismatch

    Thanks

    Neat trick

+ 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] Type mismatch on a date textbox when leaving it blank
    By shardin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2012, 05:25 AM
  2. Type Mismatch-calculating textbox values from different multipage tabs
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2012, 04:52 PM
  3. Convert text to number cDec(xCell.Value)
    By LiLi1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2012, 01:49 PM
  4. Mismatch in VBA on TextBox
    By seeks4truth in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2009, 02:58 PM
  5. CInt() conversion & inputbox
    By dems in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-03-2009, 07:39 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