+ Reply to Thread
Results 1 to 2 of 2

Dynamic List From Single Column of Named Range Table (Permit Open/Close Bracket)

Hybrid View

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    41

    Dynamic List From Single Column of Named Range Table (Permit Open/Close Bracket)

    I'm stumped. I'm trying to fix a dynamic drop down list that was using an "=Offset" function in Excel, but is now getting #REF errors because I have created a macro to update the list from another document. This macro removes the old data (which creates the #REF) and refreshes it. I'm trying to figure out now how to refresh the list after the table has been updated.

    I've managed to get past the steps where VBA is pulling the data, then creating the table, creating a named range, and finally creating a data validation list. My problem is in trying to specify a single column in the table, as I cannot get the brackets to be accepted by VBA so that my target for the list is "Group_ID_Table[Sub-Group Name]". I've finally managed to get the named range to create a function to provide "=Group_ID_Table" as the named range, as it was previously providing a text string of ""=Group_ID_Table"" (notice the extra double quote).

    The problem I run into now is that the table is multiple columns, but data validation list can only accept a single column. When I try to specify the column "[Sub-Group Name]", I end up with a Run-time error '1004'. I believe that the open and close brackets are as I've tried substituting those characters with their ASCII values and concatenating the string together to create the appropriate named range "Group_ID_Table[Sub-Group Name]", but still run into an error.

    Any suggestions?


    ' Fill Empty Account ID Cells with non-breaking space and convert to table.
        Dim last_row As Integer
            last_row = Range("A1").End(xlDown).Row
        Dim rng As Range
           Set rng = Range("C1:C" & last_row)
        For Each cell In rng.Cells
            cell.Activate
            If ActiveCell.Value = "" Then
               ActiveCell.Value = "N/A"
            End If
       Next cell
        ActiveSheet.ListObjects.Add(xlSrcRange, Range("A1:D" & last_row), , xlYes).Name = "Group_ID_Table"
        a = "[Sub-Group Name]"
       
        ActiveWorkbook.Names.Add Name:="GroupIDSubGroupName", RefersTo:="=" & "Group_ID_Table" & a
        
    
    Private Sub main()
    
    ' Create Drop Down Account List From Group_ID_Table
      With Range("F4").Validation
    	.Delete
    	.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="GroupIDSubGroupName"
    	.IgnoreBlank = True
    	.InCellDropdown = True
    	.InputTitle = ""
    	.ErrorTitle = ""
    	.InputMessage = ""
    	.ErrorMessage = ""
    	.ShowInput = True
    	.ShowError = True
      End With
    
    End Sub

  2. #2
    Registered User
    Join Date
    12-27-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Dynamic List From Single Column of Named Range Table (Permit Open/Close Bracket)

    Changed my target for the Named Range to

    RefersTo:="=" & "Group_ID_Table[[#All],[SUB-GROUP NAME]]"
    and it worked.

+ 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. Dynamic named range for a column
    By amartino44 in forum Excel General
    Replies: 10
    Last Post: 08-28-2013, 04:49 PM
  2. [SOLVED] Dynamic Named Range Help - Range Based on Values in Column
    By Filibuster in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-03-2012, 11:13 AM
  3. Dynamic Named Range List not being updated dynamically
    By scherian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-09-2012, 04:55 PM
  4. Filling a list box with a dynamic named range
    By Alicita in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-01-2011, 04:12 PM
  5. [SOLVED] Identifying single column within named range
    By ESAEO in forum Excel General
    Replies: 2
    Last Post: 03-24-2005, 06:06 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