+ Reply to Thread
Results 1 to 3 of 3

VBA inputbox error - looping problem

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    Osijek, Croatia
    MS-Off Ver
    2010
    Posts
    4

    VBA inputbox error - looping problem

    Hi everyone,

    I am new here and in VBA.
    I have a problem with inputboxes.

    I have put two same inputboxes in one macro, which should fill cells with entered data.
    However, the second inputbox does not work properly. It keeps returning me to input box when i enter the requested number. I cant see what is the problem, since the code is the same for both inputboxes.

    Can someone please help me with this?
    Also, is there any way to merge these two inputboxes into one (two lines which can be used separately in two different cells)?

    *These two inputboxes worked when i originally made them to work under commandbutton in excel. However, i decided to put it as commandbutton in userform and that messed it up.

    First inputbox: (working)

    Private Sub receivables_from_related_parties()

    Enter:
    On Error GoTo Badentry
    PPO = InputBox("Enter amount of receivables from related parties as of" & TextBox2.Text, "Receivables from related parties", "Enter whole number without decimal points")
    If Not IsNumeric(PPO) Then
    GoTo Badentry
    Else
    Call FORMULE2
    Exit Sub
    End If
    Badentry:
    MsgBox "Only numbers can be entered"
    Resume Enter:
    Call FORMULE2

    End Sub
    _____________
    Second input box (looping error)

    Private Sub Liabilities_towards_related_parties()

    Enter:
    On Error GoTo Badentry
    OPOO = InputBox("Enter amount of liabilities towards related parties as of " & TextBox2.Text & _
    " !Without loans!", "Liabilities towards related parties", "Enter whole number without decimal points")
    If Not IsNumeric(OPOO) Then
    GoTo Badentry
    Else
    Call FORMULE3
    Exit Sub
    End If
    Badentry:
    MsgBox "Only numbers can be entered"
    Resume Enter:
    Call FORMULE3

    End Sub
    _________
    Both, PPO and OPOO are declared as strings (public) in module.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: VBA inputbox error - looping problem

    TRY:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-04-2014
    Location
    Osijek, Croatia
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA inputbox error - looping problem

    It does not help.
    I guess the problem is somewhere else. I found more problems with easy lines like copy and paste special, which worked before i decided to put userform in the whole story.
    Thanks anyway.

+ 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] Inputbox error message. Formula you typed contains an error.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-09-2013, 02:25 PM
  2. [SOLVED] InputBox option and its features(looping,row switching,data collecting)
    By 4evra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2013, 02:05 PM
  3. [SOLVED] Looping sub not detecting user cancel from inputbox
    By jshaw82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2013, 06:14 PM
  4. InputBox Error.
    By jonnyuk3 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-05-2008, 04:13 AM
  5. inputbox (error if close)
    By CatherineN in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2006, 02:10 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