+ Reply to Thread
Results 1 to 6 of 6

InputBox issue

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    InputBox issue

    Hi all

    I don't understand the problem with this:

    Please Login or Register  to view this content.
    If I input a number it works fine, but if I input a letter (or press cancel) it gives me an error. I thought the IfNumeric should have taken care of that, no?
    Last edited by VanniFucci; 04-01-2013 at 06:17 AM. Reason: Use code tags in future.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Help with this basic macro

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: InputBox issue

    All done, apologies I'm new here
    Last edited by VanniFucci; 04-01-2013 at 05:49 AM.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: InputBox issue

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: InputBox issue

    Thank you now it works. Could you explain the reasons behind it? I thought to declare the variable as a number (as opposed to text) was the way to go...

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: InputBox issue

    You had already put a check in place to ensure that if its not a number, the code should exit sub. So the variable had to be declared in such a way that it allows all types of entry.

  7. #7
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: InputBox issue

    Understood thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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