+ Reply to Thread
Results 1 to 9 of 9

Restrict Values That Can Be Entered in a Cell

  1. #1
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Restrict Values That Can Be Entered in a Cell

    Hi,

    How to insert in the macro below a check that if a user enter value 20 or higher then a message box and clear contents.

    Thanks
    Please Login or Register  to view this content.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Restrict Values That Can Be Entered in a Cell

    check that if a user enter value 20 or higher then a message box and clear contents
    Where are they entering the value you want checked? Into the following cell?

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Restrict Values That Can Be Entered in a Cell

    Hi walruseggman,

    Upload workbook with complete code (Module1).Entering the value in row 12 (B12:K12).

    Thanks

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Restrict Values That Can Be Entered in a Cell

    Can this help?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Restrict Values That Can Be Entered in a Cell

    Data Validation will do this without any VBA.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Restrict Values That Can Be Entered in a Cell

    @JOHN, works perfectly, Thanks
    @mikerickson, I've tried data validation but it doesn't work coz I'm using macro to enter value, It will only work if you enter the value manually.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Restrict Values That Can Be Entered in a Cell

    You're welcome. Glad to help out and thanks for the feedback.

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Restrict Values That Can Be Entered in a Cell

    The OP code shows the suspect value already in the cell. If the value is being put in the cell with VBA, it might be better to do the validation before actually putting it into a cell. VBA usually precludes UnDo and you might want to tell the user that something is wrong before they lose the data that was previously in the cell.

  9. #9
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Restrict Values That Can Be Entered in a Cell

    Hi JOHN,

    Sorry to bother you again but I want to add another range (E5:N5), but this time not greater than 2240 with different message.

    Thanks

+ 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. Restrict the value entered into a textbox on a userform
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2015, 05:30 PM
  2. Counting numeric values when several values are entered in a cell
    By Tryin2Excel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-20-2015, 02:30 PM
  3. [SOLVED] Sheet Change Event Dubuggin: Restrict Cell Values toand Changing cells based on input
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-28-2013, 02:37 PM
  4. Replies: 4
    Last Post: 08-15-2013, 08:16 AM
  5. [SOLVED] Log values entered in a cell single cell via drown menu on sheet1 onto sheet2 in a row
    By jaithorry in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-04-2013, 10:57 AM
  6. Replies: 13
    Last Post: 08-17-2011, 02:16 PM
  7. Restrict the date format entered in a cell
    By skonduru in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-22-2010, 04:43 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