Hi Farrukh,
After you import the userform1 and userform2, you cannot see the list in your combo box...this is because in your master file, there is no "Defined Name Range" yet. For easily modification to your master file, I suggest you to...
- copy sheet "protected" to all your Master files, this is to keep the worksheet structure of your authentication control.
- In the Worksheet event procedure add these lines of code to create Name Range
- ActiveWorkbook.Names.Add Name:="Users", RefersToR1C1:= _
"=OFFSET(Protected!R1C1,1,0,COUNTA(Protected!C1)-1,1)"
ActiveWorkbook.Names("Users").Comment = ""
- ActiveWorkbook.Names.Add Name:="Users_List", RefersToR1C1:= _
"=OFFSET(Protected!R1C1,1,0,COUNTA(Protected!C1)-1,2)"
ActiveWorkbook.Names("Users_List").Comment = ""
- I keep all your both sheets "Protected" and "Blank", in order to keep your code run (your code run by "Fixed Sheet Name").
- I change you authen table to be easily monitor (user and password) by...
- In file ImportUserFormTest1.xlsm
- Farrukh 1= FR1
- Farrukh 2=FR2
- Farrukh 3=FR3
Here attachment ---> ImportUserFormTest1.zip
---------------here is the code In the Worksheet event procedure---------------
Private Sub Workbook_Open()
If Sheets("Blank").Visible <> xlSheetVisible Then
Sheets("Blank").Visible = xlSheetVisible
End If
Sheets("Blank").Select
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ActiveWorkbook.Names.Add Name:="Users", RefersToR1C1:= _
"=OFFSET(Protected!R1C1,1,0,COUNTA(Protected!C1)-1,1)"
ActiveWorkbook.Names("Users").Comment = ""
ActiveWorkbook.Names.Add Name:="Users_List", RefersToR1C1:= _
"=OFFSET(Protected!R1C1,1,0,COUNTA(Protected!C1)-1,2)"
ActiveWorkbook.Names("Users_List").Comment = ""
Sheets("Protected").Visible = xlSheetVisible
UserForm1.Show
End Sub
-------------------------------------------------------------------------
Hope this help.
Pichart Y.