Consulting

Results 1 to 4 of 4

Thread: I'm trying to perform two validations on a range of cells at the same time

  1. #1
    VBAX Newbie
    Joined
    Jul 2022
    Posts
    2
    Location

    I'm trying to perform two validations on a range of cells at the same time

    Hi all! This is my first ever post!

    I'm a total newcomer to coding with VBA, but totally keen to learn! I have a very basic knowledge of Excel and can use simple Macros and Functions etc. I actually feel I should be able to figure my problem out myself but I've had no joy finding a solution.

    MY PROBLEM:

    I'm basically trying to perform two validations on a range of cells at the same time. The first validation would make the user choose from a 'validation list' and the second validation would make sure there would also be no duplicate entries.

    As you can see - I can get both of these validations to work individually, but I'm having trouble combining the two so they both work at the same time!

    Validation Pic 1.jpg Validation Pic 2.jpg

    The validation list takes from data in these cells: ='Data Lists'!$A$2:$A$96

    The code I use to prevent duplicate entries: =COUNTIF($C$3:$C$93,C3)=1


    Any help would be much appreciated!!!

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Maybe use 1 DV condition and Conditional Formatting to flag dups


    Capture.JPG
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Newbie
    Joined
    Jul 2022
    Posts
    2
    Location
    Thanks for the reply Paul - but I'm looking to validate at the data entry stage rather than searching for duplicates after all data is entered...

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Quote Originally Posted by Mendez View Post
    Thanks for the reply Paul - but I'm looking to validate at the data entry stage rather than searching for duplicates after all data is entered...
    I believe my example XLSX does that. Just have the CF rules cover the same cells as the DV rules
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •