+ Reply to Thread
Results 1 to 5 of 5

using IF with InputBox Value

  1. #1
    Registered User
    Join Date
    01-20-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    7

    using IF with InputBox Value

    Dear All,

    Below is the code that I am using to do some formatting on a workbook with 12 sheets namely: JAN, FEB...etc
    An input box is used to make an input for staff no which is located in column D. The code works fine, except, when I test it with an invalid staff no., It still goes on to execute the code with the previously selected cell.

    Any ideas? to control this situation.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: using IF with InputBox Value

    You should remove the On Error Resume Next line as it is ignoring any errors. It's best to resolve code errors.

    This should validate the Staff No. in column D
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-20-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    7

    Re: using IF with InputBox Value

    That's it, thanks very much. It's working

  4. #4
    Registered User
    Join Date
    01-20-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    7

    Re: using IF with InputBox Value

    All functions are working but, this line of code has a problem, I don't know what
    Please Login or Register  to view this content.
    It's exiting the sub even with a value and also if a zero is entered.

    Any Ideas?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-20-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    7

    Re: using IF with InputBox Value

    Please Login or Register  to view this content.
    It's working now, thank you all

+ 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] MACRO: If user clicks cancel in inputbox,then do nothing. Problem with inputbox appearance
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2015, 04:33 AM
  2. [SOLVED] Inputbox vs. Application.InputBox
    By miyachow in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 12:53 PM
  3. [SOLVED] If inputbox = false then repeat inputbox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2013, 01:27 PM
  4. InputBox-ow to have a user input text in a inputbox
    By noodle48 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2011, 08:17 AM
  5. Screen positioning inputbox that is set as Application.InputBox
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2010, 07:59 AM
  6. InputBox-Is it possible to put 2 question in one InputBox ?
    By Shark Man in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2009, 12:04 AM
  7. Inputbox button control + msgbox for empty inputbox
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-30-2009, 12:39 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