Similar to the problem I had earlier, I'm trying to get to read my dictionary from a different workbook.
Dim rCl As Range 'analysis range
Dim dic
Set dic = CreateObject("scripting.dictionary")
With Worksheets("Sheet3")
'1 refers to Column A which is Analysis's
For Each rCl In .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp))
If Not dic.exists(CStr(rCl)) Then dic.Add CStr(rCl), rCl.Row
Next rCl
End With
cboAnalysis.List = dic.keys
'clears current drop down value to clear
cboAnalysis.Value = ""
currently reads from current workbook sheet 3 I'm running off, Im trying to get it to read off a different workbook
I'm trying to get it to work in the similar way this works:
Private Sub cmd_Request_Click()
On Error GoTo ErrorHandler
Dim RowNo As Long
Dim Id As String
Application.ScreenUpdating = False ' turn off the screen updating
'Enter Workbook names and Sheet names.
Set Wb = Workbooks.Open("S:\Information\Design Systems Engineering\CFD Methods\KG\Work Associated\KG\Projects\HPC Booking\Final Documents\Final Prep Folders\regularUsers.xls", True, True)
Set Ws = Worksheets("Sheet1")
Id = Me.txt_Request
RowNo = Application.WorksheetFunction.Match(Id, Ws.Range("A1:A999"), 0)
Me.txtName = Ws.Cells(RowNo, 2)
Me.txtPhone = Ws.Cells(RowNo, 3)
Me.txtDepartment = Ws.Cells(RowNo, 4)
Me.txtID = Ws.Cells(RowNo, 1)
CleanExit:
Wb.Close False ' close the source workbook without saving any changes
Set Wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating
Exit Sub
ErrorHandler:
MsgBox "Unable to match ID, enter valid ID.", vbOKOnly
GoTo CleanExit
End Sub
where it reads from a different workbook with and the screen updating goes on and off etc.
Any help appreciated
K
Bookmarks