BradleyLawrence
New Member
- Joined
- Jan 26, 2017
- Messages
- 2
Hello,
I am new to the forum but i'm pulling my hair on not being able to solve this one!
I have database which is filled in via a user form.
This user form returns the values to four different pages.
I can get the user form to work if i just populate the "Receiver" tab. (The first one)
It fills my data in correctly and returns the values in the correct rows!
If i choose to just enter the "Display" tab then the values are just returning to the top line and not to the correct "next row" command.
The key to my user form is i want to be able to be able to either fill the whole user form in and it returns the values to the correct row OR just fill one section and it populates that one work sheet.
Currently it works if the whole user form is filled in.
It also works for just the receiver tab.
It doesn't work for my "Display" "MyJD" and "ATU" tab.
PLEASE HELP!!!
Private Sub CommandButton1_Click()
Dim lrRE As Long, lrDIS As Long, lrMJD As Long, lrATU As Long
If ComboBoxReceiver <> "" Or TBSerial <> "" Or ComboBoxAccuracy <> "" Or TBActivation <> "" Then
lrRE = Sheets("Receiver").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Receiver").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("Receiver").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("Receiver").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("Receiver").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("Receiver").Cells(lrRE + 1, "E").Value = ComboBoxReceiver.Text
Sheets("Receiver").Cells(lrRE + 1, "F").Value = TBSerial.Text
Sheets("Receiver").Cells(lrRE + 1, "G").Value = ComboBoxAccuracy.Text
Sheets("Receiver").Cells(lrRE + 1, "H").Value = TBActivation.Text
End If
If ComboBoxDisplay <> "" Then
lrDIS = Sheets("Display").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Display").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("Display").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("Display").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("Display").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("Display").Cells(lrRE + 1, "E").Value = ComboBoxDisplay.Text
Sheets("Display").Cells(lrRE + 1, "F").Value = TBSerialD.Text
Sheets("Display").Cells(lrRE + 1, "G").Value = TBDActivation
End If
If TBUser <> "" Then
lrMJD = Sheets("MyJD").Range("A" & Rows.Count).End(xlUp).Row
Sheets("MyJD").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("MyJD").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("MyJD").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("MyJD").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("MyJD").Cells(lrRE + 1, "E").Value = TBUser.Text
Sheets("MyJD").Cells(lrRE + 1, "F").Value = TBPassword.Text
Sheets("MyJD").Cells(lrRE + 1, "G").Value = TBmtg.Text
End If
If TBSerialA <> "" Then
lrATU = Sheets("ATU").Range("A" & Rows.Count).End(xlUp).Row
Sheets("ATU").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("ATU").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("ATU").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("ATU").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("ATU").Cells(lrRE + 1, "E").Value = TBSerialA.Text
Sheets("ATU").Cells(lrRE + 1, "F").Value = TBTractor.Text
End If
Unload Me
End Sub
I am new to the forum but i'm pulling my hair on not being able to solve this one!
I have database which is filled in via a user form.
This user form returns the values to four different pages.
I can get the user form to work if i just populate the "Receiver" tab. (The first one)
It fills my data in correctly and returns the values in the correct rows!
If i choose to just enter the "Display" tab then the values are just returning to the top line and not to the correct "next row" command.
The key to my user form is i want to be able to be able to either fill the whole user form in and it returns the values to the correct row OR just fill one section and it populates that one work sheet.
Currently it works if the whole user form is filled in.
It also works for just the receiver tab.
It doesn't work for my "Display" "MyJD" and "ATU" tab.
PLEASE HELP!!!
Private Sub CommandButton1_Click()
Dim lrRE As Long, lrDIS As Long, lrMJD As Long, lrATU As Long
If ComboBoxReceiver <> "" Or TBSerial <> "" Or ComboBoxAccuracy <> "" Or TBActivation <> "" Then
lrRE = Sheets("Receiver").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Receiver").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("Receiver").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("Receiver").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("Receiver").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("Receiver").Cells(lrRE + 1, "E").Value = ComboBoxReceiver.Text
Sheets("Receiver").Cells(lrRE + 1, "F").Value = TBSerial.Text
Sheets("Receiver").Cells(lrRE + 1, "G").Value = ComboBoxAccuracy.Text
Sheets("Receiver").Cells(lrRE + 1, "H").Value = TBActivation.Text
End If
If ComboBoxDisplay <> "" Then
lrDIS = Sheets("Display").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Display").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("Display").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("Display").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("Display").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("Display").Cells(lrRE + 1, "E").Value = ComboBoxDisplay.Text
Sheets("Display").Cells(lrRE + 1, "F").Value = TBSerialD.Text
Sheets("Display").Cells(lrRE + 1, "G").Value = TBDActivation
End If
If TBUser <> "" Then
lrMJD = Sheets("MyJD").Range("A" & Rows.Count).End(xlUp).Row
Sheets("MyJD").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("MyJD").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("MyJD").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("MyJD").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("MyJD").Cells(lrRE + 1, "E").Value = TBUser.Text
Sheets("MyJD").Cells(lrRE + 1, "F").Value = TBPassword.Text
Sheets("MyJD").Cells(lrRE + 1, "G").Value = TBmtg.Text
End If
If TBSerialA <> "" Then
lrATU = Sheets("ATU").Range("A" & Rows.Count).End(xlUp).Row
Sheets("ATU").Cells(lrRE + 1, "A").Value = TBCustomer.Text
Sheets("ATU").Cells(lrRE + 1, "B").Value = TBAccount.Text
Sheets("ATU").Cells(lrRE + 1, "C").Value = TBNumber.Text
Sheets("ATU").Cells(lrRE + 1, "D").Value = TBEmail.Text
Sheets("ATU").Cells(lrRE + 1, "E").Value = TBSerialA.Text
Sheets("ATU").Cells(lrRE + 1, "F").Value = TBTractor.Text
End If
Unload Me
End Sub