'Is there a VBA code to access multiple user files in network locations

I am new with VBA coding. I am creating a macro where a 1000 rows will assigned to different users. here is some set of requirements for the macro.

  1. For each user separate sheet needs to be created based on their names in a table (Username: Vijay, Rio).
  2. Once sheet is created, based on names all the assigned data should be moved to the respective sheet from main sheet.
  3. Main Requirement: I have created a user form where a user updates his username in the form, after that, only that corresponding sheet should be visible to him. Rest others should be hidden. Example if user vijay enters sheet named "Vijay" visible.

I am struggling that user data for the table, based on which sheet is created is not constant, it changes frequently. hence I'm unable to get data from the mainsheet for each user.

Network location issue: This macro will be placed in network location, Hence when two people try to access different data at a time only one works. Example: if user vijay is working in the sheet and Rio enters Rio data is visible to user Vijay which is not expected.

Code that i tried.

Private Sub CommandButton1_Click()

     If User_Combobox.Value = "" Then
     MsgBox "Username Cannot be Blank!!!", vbInformation, "User Name"
     Exit Sub
     End If
     If Password_TB.Value = "" Then
     MsgBox "Password Cannot be Blank!!!", vbInformation, "Password"
     Exit Sub
     End If
     If User_Combobox.Value = "Admin" And Password_TB.Value = "Mora" Then
     Unload Me
     Dim Ws As Worksheet
     For Each Ws In ActiveWorkbook.Worksheets
     Ws.Visible = xlSheetVisible
     Next Ws
     Sheets("Admin").Select
     Else
     Dim Username As String
     Username = User_Combobox.Value
     Password = "GPGN"
     If Password <> "GPGN" Then
     MsgBox "Password is not matching", vbInformation, "Wrong Password"
     Exit Sub
     End If
     If Worksheets("Admin").Range("O2").Value = Username Then
     Unload Me
     Sheets("Vijay").Visible = True
     Sheets("Vijay").Select
     ActiveSheet.Range("A1").Select
     End If
     End If
     End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source