Populate listbox with a named range from another workbook

zdodson

Board Regular
Joined
Feb 29, 2012
Messages
124
I have two workbooks:

1) Settings
2) Schedule

The named range I am using ("Dates") is in the Schedule workbook, and it is updated dynamically using an offset formula.

The consolidation of such workbooks would make the file lag badly, so I don't want the named ranges consolidated into one worksheet.

I have tried all sorts of things to resolve this, but I am having some severe trouble.

Here was the most promising (adapted) solution I could find, but still no luck:

Code:
Dim wb As Workbook
Dim wks As Worksheet
Dim path As String


'Turn off screen updating
Application.ScreenUpdating = False


path = "C:\Users\Zack\Documents\Debate Program"
Set wb = Workbooks.Open(path & "Schedule and Entries Database.xlsm", True, True)


'Open source workbook
With ThisWorkbook.Worksheets("Schedle")
    'read data from source workbook
    .Range("Tournaments").Formula = wb.Worksheets("Schedule").Range("Tournaments").Formula
    End With


'Close the source book without saving changes
wb.Close False
Set wb = Nothing


'Turn on screen updating
Application.ScreenUpdating = True
End Sub


Any pointers?


Zack
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Zack,

There's two parts you need to address:
1. Getting data from the dynamic range "Dates" in the closed workbook "Schedule" into the open workbook "Settings"
2. Taking that data and populating the listbox in the "Settings" workbook.

If your approach for getting the data from the closed workbook is to open it temporarily using VBA, then the 2nd part can be done using Listbox.List and/or Listbox.AddItem in the same way that it would be the if "Dates" range was in the Settings workbook.

Do you have some code to populate a Listbox from a named range within the same workbook?
What type of listbox are you using? (Userform, Embedded in Worksheet-ActiveX, Embedded in Worksheet-Forms Control?)
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,305
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top