Tech Support Forum banner
Status
Not open for further replies.
1 - 1 of 1 Posts

· Registered
Joined
·
1 Posts
Discussion Starter · #1 ·
I have a time and activity tracking Workbook that lets users enter their hours in a database sheet by using UserForms. The database contains formulas that are copied whenever a new entry is made. (See the complete code for the UserForm below). The workbook works well in shared mode on a network, several people can enter their data, but we get a conflict when they submit data at the same time. Excel then asks which entry to keep and disregards the others.
I need to be able to have many people enter their information simultaneously. Does someone know if there is a solution/code that will place entries in a queue and will add that data to the database after the previous user has entered his/hers?
This is Urgent and any help will be greatly appreciated!!
Thank you!






Code:
Private Sub cboDept_Change()
Dim idx As Long
Dim I As Long

    idx = cboDept.ListIndex

    If idx <> -1 Then
        With Sheet8
            For I = 3 To 17
                Me.Controls("Label" & I + 12).Caption = .Range("A" & I).Offset(0, idx).Text
            Next I
        End With
    End If

End Sub

Private Sub cmdCancel3_Click()
    Unload Me
End Sub



Private Sub UserForm_Activate()
txtStartDate.Value = Format(Date, "mm / d / yy")

End Sub



Private Sub SpinButton1_Change()
txtStartDate.Value = Format(Date + SpinButton1.Value, "mm / d / yy")
Label14.Caption = SpinButton1.Value & " day(s) from Today"
End Sub

Private Sub TextBox1_Change()
txtStartDate.Value = Format(Date + SpinButton1.Value, "mm / d / yy")
Label14.Caption = SpinButton1.Value & " day(s) from Today"
End Sub

Private Sub cmdOK3_Click()

        Dim rng As Range, wd As Worksheet, R As Long
           Set wd = ActiveWorkbook.Sheets("WorkDB")
           R = wd.Range("A" & Rows.Count).End(xlUp).Row
          
           For I = 1 To 15
           If Me.Controls("TextBox" & I).Value <> "" Then
           
           R = R + 1: Set rng = wd.Range("A" & R)
            rng.Offset(-1, 0).EntireRow.Copy: rng.PasteSpecial xlPasteFormulas
               
                 rng.Value = cboName1.Value
                 rng.Offset(0, 1) = cboDept.Value
                 rng.Offset(0, 2).Value = Me.Controls("Label" & I + 14).Caption
                 rng.Offset(0, 3).Value = txtStartDate.Value
                 rng.Offset(0, 4).Value = Me.Controls("TextBox" & I).Value
                 Set rng = rng.Offset(1)

               End If
           Next I
           With Sheets("Employee Report")
              .Visible = True
              .Activate
          End With
          Sheets("Employee Report").Select
          Unload Me
    End Sub

Private Sub UserForm_Initialize()
   With Worksheets("ADMIN")
    cboDept.List = .Range("F4", .Range("F" & Rows.Count).End(xlUp)).Value
    End With
    
  With Worksheets("Employees")
    cboName1.List = .Range("A1", .Range("A" & Rows.Count).End(xlUp)).Value
    End With

End Sub

Private Sub cmdClearForm_Click()
    Call UserForm_Initialize
End Sub
 
1 - 1 of 1 Posts
Status
Not open for further replies.
Top