Fill Combobox with sheet names from another workbook

peteruson

New Member
Joined
Nov 12, 2018
Messages
1
Hi

I have a combobox in userform in workbook1 and i want to fill it with sheets names from workbook2

please help.
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,717
Office Version
2013
Platform
Windows
Try this:

Put this script in your UserForm

You need to modify the workbook name to meet your needs.
Both Workbooks must be open.
Workbook name must include extension Like: Me.xlsm

Code:
Private Sub CommandButton2_Click()
'Modified  11/12/2018  10:46:18 PM  EST
Dim i As Long
Dim ans As Long
ans = Workbooks("Book2").Sheets.Count
ComboBox1.Clear
For i = 1 To ans
    ComboBox1.AddItem Workbooks("Book2").Sheets(i).Name
Next
End Sub
 

Forum statistics

Threads
1,089,200
Messages
5,406,794
Members
403,106
Latest member
AliO

This Week's Hot Topics

Top