+ Reply to Thread
Results 1 to 4 of 4

Userform Textbox calculations divide by zero error

  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2013
    Posts
    114

    Userform Textbox calculations divide by zero error

    I'm trying to figure out where I am going wrong with my macro. the macro is tied to textbox change events for WTextBox7 & 9, but every time I type something in one of the textboxes i get a divide by zero error it should just do nothing if one of the cells is blank or has something written in it. any help would be appreciated.

    Thanks,

    Chris

    Please Login or Register  to view this content.
    Last edited by Code Flunkie; 05-27-2014 at 11:16 AM.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Userform Textbox calculations divide by zero error

    Assuming that the code is in your userform module:
    Please Login or Register  to view this content.
    you need to place the not before every part of the if statement if you want it how you have written it, i.e. if not x = y and not a = b and not etc

    Also, you need to use a . to reference the with statement.

    FWIW, you might get away with:
    Please Login or Register  to view this content.

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

    Re: Userform Textbox calculations divide by zero error

    Does this work any better?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    07-16-2009
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2013
    Posts
    114

    Re: Userform Textbox calculations divide by zero error

    works great, thanks a lot

+ 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. Fixing a divide by 0 error with iterative calculations
    By jrm0523 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 02:30 PM
  2. Help on number(hours) divide calculations
    By jet2004uk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-21-2012, 01:50 PM
  3. [SOLVED] VBA Textbox Calculations
    By zhb12810 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2012, 12:10 PM
  4. Advanced Calculations and If statements for Textbox
    By paxile2k in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-05-2010, 01:56 PM
  5. userform calculations in textbox
    By jsmity in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2007, 07:36 AM

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