You just need to prefix the workbook name in square brackets but if you just did:
ComboBox1.RowSource = "[Project.xlsx]Sheet1!G1:G" & Range("G" & Rows.Count).End(xlUp).Row
Then that would not work as you have not qualified the Range
you want to work with (e.g. the one in some worksheet in the Project workbook).
The code below will find the range in column G in Sheet1
of the Project workbook and assign the values to the ComboBox
in your UserForm
:
Option Explicit
Private Sub UserForm_Initialize()
Dim wbExternal As Workbook '<-- the other workbook with the data
Dim wsExternal As Worksheet '<-- the worksheet in the other workbook
Dim lngLastRow As Long '<-- the last row on the worksheet
Dim rngExternal As Range '<-- range of data for the RowSource
Set wbExternal = Application.Workbooks("Project.xlsx")
Set wsExternal = wbExternal.Worksheets("Sheet1") '<-- change to your sheet if required
lngLastRow = wsExternal.Range("G" & wsExternal.Rows.Count).End(xlUp).Row
Set rngExternal = wsExternal.Range("G1:G" & CStr(lngLastRow))
ComboBox1.RowSource = rngExternal.Address(External:=True)
End Sub