I have a form where information is being from a form is being added to a sheet "Database". How can I add to the current VBA and have the the same information added to the "Database" sheet on the Active workbook and another workbook "WF Manager-Database.xlsm Sheet "Activity Database". Code below:
Sub Reset()
Dim iRow As Long
iRow = [Counta(Database!A:A)] ' idetifying the last row
With EODForm
.txtDate.Value = ""
.cmbLeader.Clear
.cmbLeader.AddItem "Andy Jennings"
.cmbLeader.AddItem "Jennifer Jones"
.cmbLeader.AddItem "Kym Stumph"
.cmbLeader.AddItem "Magg Amador"
.cmbLeader.AddItem "Tami Maddocks"
.cmbLeader.AddItem "Theresa Collis"
.lbltxt1.Caption = "Walk-throughs"
.txtqty1.Value = ""
.lbltxt2.Caption = "Classes"
.txtqty2.Value = ""
.lbltxt3.Caption = "Projects"
.txtqty3.Value = ""
.lbltxt4.Caption = "Queue calls"
.txtqty4.Value = ""
.lbltxt5.Caption = "Inbox Monitoring"
.txtqty5.Value = ""
.lbltxt6.Caption = "Shells"
.txtqty6.Value = ""
.lbltxt7.Caption = "Clinical Calls"
.txtqty7.Value = ""
.lbltxt8.Caption = "Development Time"
.txtqty8.Value = ""
.lbltxt9.Caption = "Data Control"
.txtqty9.Value = ""
.lbltxt10.Caption = "SOD/EOD Worksheet"
.txtqty10.Value = ""
.cmbtxt11.Clear
.cmbtxt11.AddItem "Misc Calls"
.cmbtxt11.AddItem "Ivestigations"
.cmbtxt11.AddItem "Site Review"
.cmbtxt11.AddItem "Misc"
.cmbtxt11.AddItem "Projects "
.cmbtxt11.AddItem "Project Pre-work"
.txtqty11.Value = ""
.cmbtxt12.Clear
.cmbtxt12.AddItem "Facilitating Walk-throughs"
.cmbtxt12.AddItem "Queue calls"
.cmbtxt12.AddItem "Facilitating classes"
.cmbtxt12.AddItem "Practitioner Tasks"
.cmbtxt12.AddItem "Projects "
.cmbtxt12.AddItem "Project Pre-work"
.txtqty12.Value = ""
.lbltxt13.Caption = "Tasks (NE)"
.txtqty13.Value = ""
.lbltxt14.Caption = "Practitioners Tasks"
.txtqty14.Value = ""
.lbltxt15.Caption = "Vendor Management Tasks"
.txtqty15.Value = ""
.lbltxt16.Caption = "Staffing Agency Tasks"
.txtqty16.Value = ""
.lbltxt17.Caption = "Rapid Results Tasks"
.txtqty17.Value = ""
.txtAttn1.Value = ""
.txtAttn2.Value = ""
.txtBehave1.Value = ""
.txtBehave2.Value = ""
.LstDatabase.ColumnCount = 44
.LstDatabase.ColumnHeads = True
.LstDatabase.ColumnWidths = "45,55,90,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,100,100,100,90,90,90"
If iRow > 1 Then
.LstDatabase.RowSource = "Database!A2:AP" & iRow
Else
.LstDatabase.RowSource = "Database!A2:AP2"
End If
End With
End Sub
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Database")
iRow = [Counta(Database!A:A)] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, 2) = EODForm.txtDate.Value
.Cells(iRow, 3) = EODForm.cmbLeader.Value
.Cells(iRow, 4) = EODForm.lbltxt1.Caption
.Cells(iRow, 5) = EODForm.txtqty1.Value
.Cells(iRow, 6) = EODForm.lbltxt2.Caption
.Cells(iRow, 7) = EODForm.txtqty2.Value
.Cells(iRow, 8) = EODForm.lbltxt3.Caption
.Cells(iRow, 9) = EODForm.txtqty3.Value
.Cells(iRow, 10) = EODForm.lbltxt4.Caption
.Cells(iRow, 11) = EODForm.txtqty4.Value
.Cells(iRow, 12) = EODForm.lbltxt5.Caption
.Cells(iRow, 13) = EODForm.txtqty5.Value
.Cells(iRow, 14) = EODForm.lbltxt6.Caption
.Cells(iRow, 15) = EODForm.txtqty6.Value
.Cells(iRow, 16) = EODForm.lbltxt7.Caption
.Cells(iRow, 17) = EODForm.txtqty7.Value
.Cells(iRow, 18) = EODForm.lbltxt8.Caption
.Cells(iRow, 19) = EODForm.txtqty8.Value
.Cells(iRow, 20) = EODForm.lbltxt9.Caption
.Cells(iRow, 21) = EODForm.txtqty9.Value
.Cells(iRow, 22) = EODForm.lbltxt10.Caption
.Cells(iRow, 23) = EODForm.txtqty10.Value
.Cells(iRow, 24) = EODForm.cmbtxt11.Value
.Cells(iRow, 25) = EODForm.txtqty11.Value
.Cells(iRow, 26) = EODForm.cmbtxt12.Value
.Cells(iRow, 27) = EODForm.txtqty12.Value
.Cells(iRow, 28) = EODForm.lbltxt13.Caption
.Cells(iRow, 29) = EODForm.txtqty13.Value
.Cells(iRow, 30) = EODForm.lbltxt14.Caption
.Cells(iRow, 31) = EODForm.txtqty14.Value
.Cells(iRow, 32) = EODForm.lbltxt15.Caption
.Cells(iRow, 33) = EODForm.txtqty15.Value
.Cells(iRow, 34) = EODForm.lbltxt16.Caption
.Cells(iRow, 35) = EODForm.txtqty16.Value
.Cells(iRow, 36) = EODForm.lbltxt17.Caption
.Cells(iRow, 37) = EODForm.txtqty17.Value
.Cells(iRow, 38) = EODForm.txtAttn1.Value
.Cells(iRow, 39) = EODForm.txtAttn2.Value
.Cells(iRow, 40) = EODForm.txtBehave1.Value
.Cells(iRow, 41) = EODForm.txtBehave2.Value
.Cells(iRow, 42) = Application.UserName
.Cells(iRow, 43) = [Text(Now(), "DD-MM-YYYY")]
.Cells(iRow, 44) = [Text(Now(), "HH:MM")]
End With
End Sub
Sub Reset()
Dim iRow As Long
iRow = [Counta(Database!A:A)] ' idetifying the last row
With EODForm
.txtDate.Value = ""
.cmbLeader.Clear
.cmbLeader.AddItem "Andy Jennings"
.cmbLeader.AddItem "Jennifer Jones"
.cmbLeader.AddItem "Kym Stumph"
.cmbLeader.AddItem "Magg Amador"
.cmbLeader.AddItem "Tami Maddocks"
.cmbLeader.AddItem "Theresa Collis"
.lbltxt1.Caption = "Walk-throughs"
.txtqty1.Value = ""
.lbltxt2.Caption = "Classes"
.txtqty2.Value = ""
.lbltxt3.Caption = "Projects"
.txtqty3.Value = ""
.lbltxt4.Caption = "Queue calls"
.txtqty4.Value = ""
.lbltxt5.Caption = "Inbox Monitoring"
.txtqty5.Value = ""
.lbltxt6.Caption = "Shells"
.txtqty6.Value = ""
.lbltxt7.Caption = "Clinical Calls"
.txtqty7.Value = ""
.lbltxt8.Caption = "Development Time"
.txtqty8.Value = ""
.lbltxt9.Caption = "Data Control"
.txtqty9.Value = ""
.lbltxt10.Caption = "SOD/EOD Worksheet"
.txtqty10.Value = ""
.cmbtxt11.Clear
.cmbtxt11.AddItem "Misc Calls"
.cmbtxt11.AddItem "Ivestigations"
.cmbtxt11.AddItem "Site Review"
.cmbtxt11.AddItem "Misc"
.cmbtxt11.AddItem "Projects "
.cmbtxt11.AddItem "Project Pre-work"
.txtqty11.Value = ""
.cmbtxt12.Clear
.cmbtxt12.AddItem "Facilitating Walk-throughs"
.cmbtxt12.AddItem "Queue calls"
.cmbtxt12.AddItem "Facilitating classes"
.cmbtxt12.AddItem "Practitioner Tasks"
.cmbtxt12.AddItem "Projects "
.cmbtxt12.AddItem "Project Pre-work"
.txtqty12.Value = ""
.lbltxt13.Caption = "Tasks (NE)"
.txtqty13.Value = ""
.lbltxt14.Caption = "Practitioners Tasks"
.txtqty14.Value = ""
.lbltxt15.Caption = "Vendor Management Tasks"
.txtqty15.Value = ""
.lbltxt16.Caption = "Staffing Agency Tasks"
.txtqty16.Value = ""
.lbltxt17.Caption = "Rapid Results Tasks"
.txtqty17.Value = ""
.txtAttn1.Value = ""
.txtAttn2.Value = ""
.txtBehave1.Value = ""
.txtBehave2.Value = ""
.LstDatabase.ColumnCount = 44
.LstDatabase.ColumnHeads = True
.LstDatabase.ColumnWidths = "45,55,90,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,50,100,100,100,100,90,90,90"
If iRow > 1 Then
.LstDatabase.RowSource = "Database!A2:AP" & iRow
Else
.LstDatabase.RowSource = "Database!A2:AP2"
End If
End With
End Sub
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Database")
iRow = [Counta(Database!A:A)] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, 2) = EODForm.txtDate.Value
.Cells(iRow, 3) = EODForm.cmbLeader.Value
.Cells(iRow, 4) = EODForm.lbltxt1.Caption
.Cells(iRow, 5) = EODForm.txtqty1.Value
.Cells(iRow, 6) = EODForm.lbltxt2.Caption
.Cells(iRow, 7) = EODForm.txtqty2.Value
.Cells(iRow, 8) = EODForm.lbltxt3.Caption
.Cells(iRow, 9) = EODForm.txtqty3.Value
.Cells(iRow, 10) = EODForm.lbltxt4.Caption
.Cells(iRow, 11) = EODForm.txtqty4.Value
.Cells(iRow, 12) = EODForm.lbltxt5.Caption
.Cells(iRow, 13) = EODForm.txtqty5.Value
.Cells(iRow, 14) = EODForm.lbltxt6.Caption
.Cells(iRow, 15) = EODForm.txtqty6.Value
.Cells(iRow, 16) = EODForm.lbltxt7.Caption
.Cells(iRow, 17) = EODForm.txtqty7.Value
.Cells(iRow, 18) = EODForm.lbltxt8.Caption
.Cells(iRow, 19) = EODForm.txtqty8.Value
.Cells(iRow, 20) = EODForm.lbltxt9.Caption
.Cells(iRow, 21) = EODForm.txtqty9.Value
.Cells(iRow, 22) = EODForm.lbltxt10.Caption
.Cells(iRow, 23) = EODForm.txtqty10.Value
.Cells(iRow, 24) = EODForm.cmbtxt11.Value
.Cells(iRow, 25) = EODForm.txtqty11.Value
.Cells(iRow, 26) = EODForm.cmbtxt12.Value
.Cells(iRow, 27) = EODForm.txtqty12.Value
.Cells(iRow, 28) = EODForm.lbltxt13.Caption
.Cells(iRow, 29) = EODForm.txtqty13.Value
.Cells(iRow, 30) = EODForm.lbltxt14.Caption
.Cells(iRow, 31) = EODForm.txtqty14.Value
.Cells(iRow, 32) = EODForm.lbltxt15.Caption
.Cells(iRow, 33) = EODForm.txtqty15.Value
.Cells(iRow, 34) = EODForm.lbltxt16.Caption
.Cells(iRow, 35) = EODForm.txtqty16.Value
.Cells(iRow, 36) = EODForm.lbltxt17.Caption
.Cells(iRow, 37) = EODForm.txtqty17.Value
.Cells(iRow, 38) = EODForm.txtAttn1.Value
.Cells(iRow, 39) = EODForm.txtAttn2.Value
.Cells(iRow, 40) = EODForm.txtBehave1.Value
.Cells(iRow, 41) = EODForm.txtBehave2.Value
.Cells(iRow, 42) = Application.UserName
.Cells(iRow, 43) = [Text(Now(), "DD-MM-YYYY")]
.Cells(iRow, 44) = [Text(Now(), "HH:MM")]
End With
End Sub