+ Reply to Thread
Results 1 to 5 of 5

Overflow error when opening the Userform

Hybrid View

intex Overflow error when opening... 10-16-2014, 02:39 PM
Norie Re: Overflow error when... 10-16-2014, 02:45 PM
intex Re: Overflow error when... 10-16-2014, 02:52 PM
Norie Re: Overflow error when... 10-16-2014, 02:59 PM
intex Re: Overflow error when... 10-16-2014, 03:10 PM
  1. #1
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Overflow error when opening the Userform

    Hi,

    I have a problem with the userform, it was working fine until i have deleted some data from the DataBase sheet and now when i click button to open the userform it says "Run-time error '6': Overflow".

    I use this database at work and now it have crashed and i dont have a working copy.

    Maybe somebody can help me with this issue below i have attached the sample file. Thanks in advance.
    Attached Files Attached Files

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

    Re: Overflow error when opening the Userform

    Label73's caption is '0', so you are dividing by zero here:
    Me.Label75 = Label56.Caption / Label73
    Me.Label75 = Format(Label75, "0.0%")
    
    Me.Label77 = Label57.Caption / Label73
    Me.Label77 = Format(Label77, "0.0%")
    
    Me.Label78 = Label58.Caption / Label73
    Me.Label78 = Format(Label78, "0.0%")
    
    Me.Label79 = Label59.Caption / Label73
    Me.Label79 = Format(Label79, "0.0%")
    
    Me.Label80 = Label60.Caption / Label73
    Me.Label80 = Format(Label80, "0.0%")
    
    Me.Label81 = Label61.Caption / Label73
    Me.Label81 = Format(Label81, "0.0%")
    
    Me.Label82 = Label62.Caption / Label73
    Me.Label82 = Format(Label82, "0.0%")
    
    Me.Label83 = Label63.Caption / Label73
    Me.Label83 = Format(Label83, "0.0%")
    
    Me.Label84 = Label64.Caption / Label73
    Me.Label84 = Format(Label84, "0.0%")
    
    Me.Label85 = Label65.Caption / Label73
    Me.Label85 = Format(Label85, "0.0%")
    
    Me.Label86 = Label66.Caption / Label73
    Me.Label86 = Format(Label86, "0.0%")
    
    Me.Label87 = Label67.Caption / Label73
    Me.Label87 = Format(Label87, "0.0%")
    
    Me.Label88 = Label68.Caption / Label73
    Me.Label88 = Format(Label88, "0.0%")
    
    Me.Label89 = Label69.Caption / Label73
    Me.Label89 = Format(Label89, "0.0%")
    
    Me.Label90 = Label70.Caption / Label73
    Me.Label90 = Format(Label90, "0.0%")
    
    Me.Label76 = Label71.Caption / Label73
    Me.Label76 = Format(Label76, "0.0%")
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Overflow error when opening the Userform

    Hi Norie is there any error handler can be created to avoid this error.

    Thanks for your help

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

    Re: Overflow error when opening the Userform

    You could test for '0'.
    If Label73.Value<> "0" Then
    
    Me.Label75 = Label56.Caption / Label73
    Me.Label75 = Format(Label75, "0.0%")
    
    Me.Label77 = Label57.Caption / Label73
    Me.Label77 = Format(Label77, "0.0%")
    
    Me.Label78 = Label58.Caption / Label73
    Me.Label78 = Format(Label78, "0.0%")
    
    Me.Label79 = Label59.Caption / Label73
    Me.Label79 = Format(Label79, "0.0%")
    
    Me.Label80 = Label60.Caption / Label73
    Me.Label80 = Format(Label80, "0.0%")
    
    Me.Label81 = Label61.Caption / Label73
    Me.Label81 = Format(Label81, "0.0%")
    
    Me.Label82 = Label62.Caption / Label73
    Me.Label82 = Format(Label82, "0.0%")
    
    Me.Label83 = Label63.Caption / Label73
    Me.Label83 = Format(Label83, "0.0%")
    
    Me.Label84 = Label64.Caption / Label73
    Me.Label84 = Format(Label84, "0.0%")
    
    Me.Label85 = Label65.Caption / Label73
    Me.Label85 = Format(Label85, "0.0%")
    
    Me.Label86 = Label66.Caption / Label73
    Me.Label86 = Format(Label86, "0.0%")
    
    Me.Label87 = Label67.Caption / Label73
    Me.Label87 = Format(Label87, "0.0%")
    
    Me.Label88 = Label68.Caption / Label73
    Me.Label88 = Format(Label88, "0.0%")
    
    Me.Label89 = Label69.Caption / Label73
    Me.Label89 = Format(Label89, "0.0%")
    
    Me.Label90 = Label70.Caption / Label73
    Me.Label90 = Format(Label90, "0.0%")
    
    Me.Label76 = Label71.Caption / Label73
    Me.Label76 = Format(Label76, "0.0%")
    End If

  5. #5
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Overflow error when opening the Userform

    Brilliant as always Norie, thanks alot.

+ 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 Date Format Error 6 Overflow
    By Prexcel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-17-2014, 12:39 PM
  2. Explanation of the Run-time error '6': Overflow Error
    By mgphill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2012, 10:46 AM
  3. Want to do a while-loop but get error message: run error '6' overflow
    By danzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2011, 01:48 PM
  4. Overflow Error
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2011, 05:54 AM
  5. Out of Subscript error while opening a Userform
    By shivboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2006, 07:07 AM

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