I am attempting to drop data into multiple worksheets from data entered into a UserForm. I have already had great success from help on here setting it up thus far to drop data into 1 worksheet using a lookup code. But the 1st worksheet will require the lookup function, whereas the 2nd worksheet won't. The 2nd worksheet will only require the data to be dropped into the next available row. Is this possible to do using VBA? See existing code below:
Private Sub CommandButton1_Click()
Dim Lookup As String
Dim LookupRow As Long
Dim StandClm As Integer
Dim InstInstClm As Integer
Dim VendInClm As Integer
Dim InstEnClm As Integer
Dim BareTuClm As Integer
Dim BareTubClm As Integer
On Error Resume Next
Lookup = Me.TextBox12.Value
LookupRow = Application.Match(Lookup, Range("C:C"), 0)
StandClm = 51
InstInClm = 52
VendInClm = 53
InstEnClm = 54
BareTuClm = 55
BareTubClm = 56
PreInsuClm = 57
PreInsulClm = 58
AirDropClm = 59
MiscPanClm = 60
InstBuiClm = 61
InstHooClm = 62
If Me.Stands <> "" Then Cells(LookupRow, StandClm) = Me.Stands
If Me.Instruments_Installed <> "" Then Cells(LookupRow, InstInClm) = Me.Instruments_Installed
If Me.Vendor_Instruments <> "" Then Cells(LookupRow, VendInClm) = Me.Vendor_Instruments
If Me.Instrument_Enclosures <> "" Then Cells(LookupRow, InstEnClm) = Me.Instrument_Enclosures
If Me.Bare_Tubing_Footage <> "" Then Cells(LookupRow, BareTuClm) = Me.Bare_Tubing_Footage
If Me.Bare_Tubing_Footage_Test <> "" Then Cells(LookupRow, BareTubClm) = Me.Bare_Tubing_Footage_Test
If Me.Pre_Insulated_Tubing <> "" Then Cells(LookupRow, PreInsuClm) = Me.Pre_Insulated_Tubing
If Me.Pre_Insulated_Tubing_Test <> "" Then Cells(LookupRow, PreInsulClm) = Me.Pre_Insulated_Tubing_Test
If Me.Air_Drops <> "" Then Cells(LookupRow, AirDropClm) = Me.Air_Drops
If Me.Misc_Panels <> "" Then Cells(LookupRow, MiscPanClm) = Me.Misc_Panels
If Me.Instrument_Buildings <> "" Then Cells(LookupRow, InstBuiClm) = Me.Instrument_Buildings
If Me.Instrument_Hook_Ups <> "" Then Cells(LookupRow, InstHooClm) = Me.Instrument_Hook_Ups
End Sub
Private Sub CommandButton2_Click()
Dim ctl As MSForms.Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
ctl.Text = ""
Case "CheckBox", "OptionButton", "ToggleButton"
ctl.Value = False
Case "ComboBox", "ListBox"
ctl.ListIndex = -1
End Select
Next ctl
End Sub
Private Sub CommandButton3_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub
Private Sub CommandButton1_Click()
Dim Lookup As String
Dim LookupRow As Long
Dim StandClm As Integer
Dim InstInstClm As Integer
Dim VendInClm As Integer
Dim InstEnClm As Integer
Dim BareTuClm As Integer
Dim BareTubClm As Integer
On Error Resume Next
Lookup = Me.TextBox12.Value
LookupRow = Application.Match(Lookup, Range("C:C"), 0)
StandClm = 51
InstInClm = 52
VendInClm = 53
InstEnClm = 54
BareTuClm = 55
BareTubClm = 56
PreInsuClm = 57
PreInsulClm = 58
AirDropClm = 59
MiscPanClm = 60
InstBuiClm = 61
InstHooClm = 62
If Me.Stands <> "" Then Cells(LookupRow, StandClm) = Me.Stands
If Me.Instruments_Installed <> "" Then Cells(LookupRow, InstInClm) = Me.Instruments_Installed
If Me.Vendor_Instruments <> "" Then Cells(LookupRow, VendInClm) = Me.Vendor_Instruments
If Me.Instrument_Enclosures <> "" Then Cells(LookupRow, InstEnClm) = Me.Instrument_Enclosures
If Me.Bare_Tubing_Footage <> "" Then Cells(LookupRow, BareTuClm) = Me.Bare_Tubing_Footage
If Me.Bare_Tubing_Footage_Test <> "" Then Cells(LookupRow, BareTubClm) = Me.Bare_Tubing_Footage_Test
If Me.Pre_Insulated_Tubing <> "" Then Cells(LookupRow, PreInsuClm) = Me.Pre_Insulated_Tubing
If Me.Pre_Insulated_Tubing_Test <> "" Then Cells(LookupRow, PreInsulClm) = Me.Pre_Insulated_Tubing_Test
If Me.Air_Drops <> "" Then Cells(LookupRow, AirDropClm) = Me.Air_Drops
If Me.Misc_Panels <> "" Then Cells(LookupRow, MiscPanClm) = Me.Misc_Panels
If Me.Instrument_Buildings <> "" Then Cells(LookupRow, InstBuiClm) = Me.Instrument_Buildings
If Me.Instrument_Hook_Ups <> "" Then Cells(LookupRow, InstHooClm) = Me.Instrument_Hook_Ups
End Sub
Private Sub CommandButton2_Click()
Dim ctl As MSForms.Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
ctl.Text = ""
Case "CheckBox", "OptionButton", "ToggleButton"
ctl.Value = False
Case "ComboBox", "ListBox"
ctl.ListIndex = -1
End Select
Next ctl
End Sub
Private Sub CommandButton3_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub