+ Reply to Thread
Results 1 to 2 of 2

Error running validation code

Hybrid View

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    Bay Area, CA
    MS-Off Ver
    Excel 2007
    Posts
    43

    Error running validation code

    Hi All,

    I'm running a code where I create 4 different dropdown lists in a range of cells. However, on one of the lines I get an error "Application-defined or object-defined error." The code looks exactly the same as the 3 lines above it just with different cells it's being assigned to. Any advice would be appreciated. Here's my code:


    Worksheets("Main").Range("C16,D13,D17,E13,E18,F14,F15,F16,F17").Validation.Add 3, , , Join(Application.Transpose(Sheets("DropDown").Columns(12).SpecialCells(2)), ",")
                    Worksheets("Main").Range("C14,C15,D14,D15,D16,E14,E16,E17").Validation.Add 3, , , Join(Application.Transpose(Sheets("DropDown").Columns(2).SpecialCells(2)), ",")
                    Worksheets("Main").Range("C17,D12,D18,E12,E19,G14,G15,G16,G17").Validation.Add 3, , , Join(Application.Transpose(Sheets("DropDown").Columns(32).SpecialCells(2)), ",")
                    Worksheets("Main").Range("C18,D11,D19,E11,E20,H14,H15,H16,H17").Validation.Add 3, , , Join(Application.Transpose(Sheets("DropDown").Columns(37).SpecialCells(2)), ",")


    Thanks in advance
    Last edited by alexwgordon; 08-30-2011 at 07:26 PM.

  2. #2
    Registered User
    Join Date
    01-13-2011
    Location
    Bay Area, CA
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Error running validation code

    I figured out what the issue was. While calling to perform the dropdown list of a certain cell D11, I realized earlier in my code that I had not counted that cell in the lines:

    Me.Range("C11:H20").ClearContents
    Me.Range("C11:H20").Validation.Delete
    It originally read C12:H20. Changing the commands to encompass all the cells to be validated solved the problem.

+ 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