+ Reply to Thread
Results 1 to 6 of 6

VBA Data Validation with Objects

  1. #1
    Registered User
    Join Date
    03-13-2011
    Location
    Holland
    MS-Off Ver
    Excel 2007
    Posts
    45

    VBA Data Validation with Objects

    Dear users,

    I have an excel sheet that activates a macro to create a data validation list when a certain area is activated by double clicking.
    This datavalidation list is based on the value to cell to the left of where the validation list will appear.
    The formula looks like this:
    Please Login or Register  to view this content.
    Because the cell G7 wil change for each data validation to the row where the validation list is created i tried to adapt the code to what you see below. But unfortunately it does not work and gives me an error on the Offset formula line (object defined error). I'm quite new to this and can't figure out how to solve this.
    I hope some of you have an answer to this.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA Data Validation with Objects

    Hello John,

    This modification to your code should work.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-13-2011
    Location
    Holland
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA Data Validation with Objects

    Dear Leith,

    Thanks for your reply. It seems now that the Named Ranges I use are probably the problem. The code still isn't working because of object defined errors. When i replace the CustomerName with a cell like G7 and I run the code I still get this error. I know, should have tested this before :S

    So I think I have to change something with the named ranges I use as well. You maybe know what this is?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA Data Validation with Objects

    Hello John,

    Are the named ranges global or local? Local means the named range must include the worksheet name when referenced.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA Data Validation with Objects

    VBA is US-centric unless explicitly told to do otherwise (e.g. FormulaLocal vs Formula)

    In this particular instance given no Formula1-Local equivalent exists you should revert to US delimiters in your VBA

    Please Login or Register  to view this content.
    Excel will automatically adjust the delimiters accordingly upon execution (per locale).

    You may also wish to add a Cancel = True
    (pending personal preference of subsequent action of course)

  6. #6
    Registered User
    Join Date
    03-13-2011
    Location
    Holland
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA Data Validation with Objects

    Thanks DonkeyOte. That fixed it!

+ 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