Thread: [Solved] Where to go from here?
View Single Post
 
Old 03-29-2016, 01:10 AM
highrise955 highrise955 is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Which is precisely what the code does. All you need to do is point the code to your workbook & worksheet, by adjusting the lines:
StrWkBkNm = "C:\Users\" & Environ("Username") & "\Documents\Workbook Name.xls"
StrWkShtNm = "Sheet1"
As coded, the macro expects the dropdown to be populated to be the first one in the document, but I'm sure you can see where you can change that in the code.

OK, I think I figured it out. I got the code to work but I have one final question...

Code:
With xlWkBk.Worksheets(StrWkSht)
    ' Find the last-used row in column A.
    LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    ' Populate the content control,
    ActiveDocument.ContentControls(4).DropdownListEntries.Clear
    For i = 1 To LRow
      ActiveDocument.ContentControls(4).DropdownListEntries.Add Text:=Trim(.Range("A" & i)), Value:=Trim(.Range("B" & i))
    Next
  End With
How do I exclude Row 1 from the worksheet when it populates the DropdownList? I'm using that row as the column titles. Better yet, can I specify a specific row to start the .Range at?

Your input (and patience) is very much appreciated.
Reply With Quote