+ Reply to Thread
Results 1 to 5 of 5

Programmatically add validation error. Previous users' posts haven't solved the problem.

  1. #1
    Registered User
    Join Date
    08-05-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Programmatically add validation error. Previous users' posts haven't solved the problem.

    Hi all,

    I've found similar questions to mine in multiple posts on multiple sites to solve this issue; unfortunately, none of the solutions have worked for me. I'm trying to create a block of code that will create a new data validation every time I run the code. The validation part of my code (which is part of a larger macro) is as follows:

    Please Login or Register  to view this content.
    Notes:
    1.Tables is a different worksheet where dates have already been added in the following format (with each item in its own cell): No 2016 2017 2018 2019
    2.table_Row has already been defined as the row that contains the horizontal list I want to reference for the validation (I've used this variable in other parts of the code, so I'm pretty sure this isn't the problem)
    3. iss_Col-1 refers to the column that will include the "No" in note 1. above. This was defined as an integer variable. (again, this variable has been used, so the problem isn't here)
    4. mat_Col refers to the column that will include the "2019" in note 1. above. This was defined as an integer variable. (again, this variable has been used, so the problem isn't here)
    5. The error I get is either a run-time error 13 or 1004 (changes depending on the changes I make based on suggestions from similar forums)
    6. I can't absolute reference any of the cells or ranges above, because there will be a new validation for each new row added.

    I can possibly post more code but can't release the whole workbook, because the information is proprietary.

    Thanks!
    Kyle

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Programmatically add validation error. Previous users' posts haven't solved the proble

    It's hard to tell but it looks like your are trying to create a range reference from cells that contain range references.

    So for example A1:A10 where A1 is text in a cell defined by the iss_Col-1 value and A10 is referenced by mat_Col.

    Is that assumption correct?

    it would probably help to fully qualify the range references you are using,
    Please Login or Register  to view this content.
    Otherwise post example workbook
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    08-05-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Programmatically add validation error. Previous users' posts haven't solved the proble

    Hi Andy,

    Thanks for your quick response!

    The cells in the range defined by the variables table_Row, iss_Col and mat_Col all contain hard coded numbers and either the word "No" or "No call". Does this answer your question?

    Best,
    Kyle

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Programmatically add validation error. Previous users' posts haven't solved the proble

    without seeing actual example it's hard to say.

    But assuming the cells contain the word "No call" then

    Please Login or Register  to view this content.
    would be like using

    Please Login or Register  to view this content.
    which of course will not work.

    As suggested post example workbook, including a cell with the actually validation reference that would be created

  5. #5
    Registered User
    Join Date
    08-05-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Programmatically add validation error. Previous users' posts haven't solved the proble

    That makes sense. Since your last post, I added ".address" after the Cells methods. For example:
    Please Login or Register  to view this content.
    See attached for the example workbook.
    Attached Files Attached Files

+ 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] How do I mark posts solved?
    By ammartino44 in forum The Water Cooler
    Replies: 2
    Last Post: 01-06-2014, 01:08 PM
  2. [SOLVED] Validation problem with reading Lists
    By scottpattison in forum Excel General
    Replies: 8
    Last Post: 08-11-2013, 02:06 PM
  3. Combining the solutions of two previous posts
    By Martijn79 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2013, 03:35 PM
  4. Thanks button or +Rep for Users on posts
    By a31185 in forum Suggestions for Improvement
    Replies: 14
    Last Post: 05-23-2012, 11:41 AM
  5. How to check my previous posts
    By singhabhijitkumar in forum ExcelTip.com Feedback / Comments / Suggestions
    Replies: 1
    Last Post: 02-08-2010, 04:14 AM
  6. how do I mark all my posts solved?
    By Joe Miller in forum Excel General
    Replies: 5
    Last Post: 02-27-2009, 07:21 AM
  7. [SOLVED] automation error on Validation.Add
    By twd000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-06-2009, 11:21 AM
  8. Time Sheets (Yes, I've already done a search on previous posts)
    By LM813 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 01-12-2006, 08:04 PM

Tags for this Thread

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