I wish for the user to select a value from a column in a worksheet using a combo-box in a userform - from there, the program extracts a value from within that row (specifically, a hyperlink to another workbook). After that, another userform (list box) is supposed to pop up, populated with values from a row in the second workbook.
Currently, the specific thing I'm having a problem with is transferring the hyperlink value (which is a variant) to the second useform's code so it can grab values from the workbook the hyperlink directs to.
I've tried making the hyperlink variable public and I've tried replicating similar operations I found on the internet.
In the first userform's code:
Public hyperlink_A As Variant
Private Sub findColumns_button_Click() 'within uf_TestSelector
With uf_ColSelectA
.hyperlink_A = hyperlink_A
.Show
End With
fillData 'not relevant
End Sub
In the second userform's code:
Option Explicit
Public mainWorkbook As Workbook
Public hyperlink_A As Variant
Private Sub UserForm_Initialize() 'uf_ColSelectA
With Application.ActiveWindow
Me.Left = .Left + (.Width - Me.Width) / 2
Me.Top = .Top + (.Height - Me.Height) / 2
End With
MsgBox hyperlink_A 'shows empty MsgBox so hyperlink_A = empty
'MsgBox only for debugging purposes
Dim wb As Workbook
Set wb = Workbooks.Open(Filename:=hyperlink_A)
End Sub
I'm expecting MsgBox hyperlink_A to open a MsgBox with the path to the second workbook, currently it's returning an empty MSgBox. The Second userform does show (but obviously empty)