+ Reply to Thread
Results 1 to 6 of 6

Input Box prompts Message Box

  1. #1
    Registered User
    Join Date
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    17

    Input Box prompts Message Box

    Hi,

    I am writing some (fairly basic) code where a user inputs a number to an input box which is then copied to a cell but I am trying to add a little extra functionality whereby if the value input results in an error i.e. the details related to that number are 'not found' (by a vlookup with an if in a different cell) then an message box is displayed with "Not Found". I've had a bash with little success but I think it's mainly because I don't know where to place the lines in my code.

    Hope you can help.

    Thanks

    Please Login or Register  to view this content.
    Last edited by cfherd; 05-04-2012 at 07:10 AM.

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

    Re: Input Box prompts Message Box

    Do you have to compare your inputbox value to just 1 cell or multiple cells?
    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
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Input Box prompts Message Box

    Just 1 cell, in this case If E17 = "Not Found" then I want to display the message box but only where cell E5 is populated. I Think I need an Else If but could be wrong!

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

    Re: Input Box prompts Message Box

    So you mean that if the value provided by the user in the inputbox does not match A17, a message box should be displayed?

  5. #5
    Registered User
    Join Date
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Input Box prompts Message Box

    I am probably not explaining it well, sorry!

    A user inputs a number via the Input Box which is then put into cell E5. There is then a VLookup from that cell value to display related data in other cells. What I want to do is where the Vlookup returns a #N/A (though I've used IFERROR so it would return "Not Found") a message box is displayed stating "Not Found". Hope that makes sense.

    Only other situation is that where the user enters nothing by just clicking ok (with out type in a number) or clicks cancel, I want cell E5 to be blank, hence the IF strSearch = "".

    Thanks for your help so far!
    Last edited by cfherd; 05-04-2012 at 08:50 AM.

  6. #6
    Registered User
    Join Date
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Input Box prompts Message Box

    Think I've cracked it, probably better ways of coding it but here's what I've done and it seems to work.

    Please Login or Register  to view this content.

+ 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