S
sarasa
I have code below:
when i enter all field and press addrecord it does not store i
workbook second record. instead, first record erased and stored secon
value. could you any body help me this code?
Private Sub CommandButton1_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("a65536").End(xlUp)
If OptionButton1.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton1.Caption
Else
If OptionButton2.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton2.Caption
Else
If OptionButton3.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton3.Caption
End If
End If
End If
If OptionButton4.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton4.Caption
Else
If OptionButton5.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton5.Caption
Else
If OptionButton6.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton6.Caption
End If
End If
End If
If OptionButton7.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton7.Caption
Else
If OptionButton8.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton8.Caption
Else
If OptionButton9.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton9.Caption
Else
If OptionButton10.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton10.Caption
Else
If OptionButton11.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. Other"
LastRow.Offset(3, 3).Value = TextBox1.Text + " Months"
End If
End If
End If
End If
End If
If OptionButton11.Value = False Then
LastRow.Offset(3, 3).Value = " "
End If
LastRow.Offset(4, 1).Value = "Question 4. " + TextBox2.Text
LastRow.Offset(4, 2).Value = "Physician: "
LastRow.Offset(4, 3).Value = " " + TextBox2.Text
LastRow.Offset(5, 2).Value = " NP/RN: "
LastRow.Offset(5, 3).Value = " " + TextBox3.Text
LastRow.Offset(6, 2).Value = " Other: "
LastRow.Offset(6, 3).Value = " " + TextBox4.Text
LastRow.Offset(7, 2).Value = " Total: "
LastRow.Offset(7, 3).Value = " " + TextBox5.Text
LastRow.Offset(4, 5).Value = " Salary: "
LastRow.Offset(4, 5).Value = " " + TextBox6.Text
LastRow.Offset(5, 4).Value = "Operational: "
LastRow.Offset(5, 5).Value = " " + TextBox7.Text
LastRow.Offset(6, 4).Value = " Capital: "
LastRow.Offset(6, 5).Value = " " + TextBox8.Text
LastRow.Offset(7, 4).Value = " Total: "
LastRow.Offset(7, 5).Value = " " + TextBox9.Text
LastRow.Offset(8, 1).Value = "Question 5. " + TextBox10.Text
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub CommandButton3_Click()
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
TextBox9.Text = " "
TextBox10.Text = " "
OptionButton1.Value = False
OptionButton2.Value = False
OptionButton3.Value = False
OptionButton4.Value = False
OptionButton5.Value = False
OptionButton6.Value = False
OptionButton7.Value = False
OptionButton8.Value = False
OptionButton9.Value = False
OptionButton10.Value = False
OptionButton11.Value = False
End Sub
Private Sub Frame5_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub UserForm_Click()
End Su
when i enter all field and press addrecord it does not store i
workbook second record. instead, first record erased and stored secon
value. could you any body help me this code?
Private Sub CommandButton1_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("a65536").End(xlUp)
If OptionButton1.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton1.Caption
Else
If OptionButton2.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton2.Caption
Else
If OptionButton3.Value = True Then
LastRow.Offset(1, 1).Value = "Question 1. " + OptionButton3.Caption
End If
End If
End If
If OptionButton4.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton4.Caption
Else
If OptionButton5.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton5.Caption
Else
If OptionButton6.Value = True Then
LastRow.Offset(2, 1).Value = "Question 2. " + OptionButton6.Caption
End If
End If
End If
If OptionButton7.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton7.Caption
Else
If OptionButton8.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton8.Caption
Else
If OptionButton9.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton9.Caption
Else
If OptionButton10.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. " + OptionButton10.Caption
Else
If OptionButton11.Value = True Then
LastRow.Offset(3, 1).Value = "Question 3. Other"
LastRow.Offset(3, 3).Value = TextBox1.Text + " Months"
End If
End If
End If
End If
End If
If OptionButton11.Value = False Then
LastRow.Offset(3, 3).Value = " "
End If
LastRow.Offset(4, 1).Value = "Question 4. " + TextBox2.Text
LastRow.Offset(4, 2).Value = "Physician: "
LastRow.Offset(4, 3).Value = " " + TextBox2.Text
LastRow.Offset(5, 2).Value = " NP/RN: "
LastRow.Offset(5, 3).Value = " " + TextBox3.Text
LastRow.Offset(6, 2).Value = " Other: "
LastRow.Offset(6, 3).Value = " " + TextBox4.Text
LastRow.Offset(7, 2).Value = " Total: "
LastRow.Offset(7, 3).Value = " " + TextBox5.Text
LastRow.Offset(4, 5).Value = " Salary: "
LastRow.Offset(4, 5).Value = " " + TextBox6.Text
LastRow.Offset(5, 4).Value = "Operational: "
LastRow.Offset(5, 5).Value = " " + TextBox7.Text
LastRow.Offset(6, 4).Value = " Capital: "
LastRow.Offset(6, 5).Value = " " + TextBox8.Text
LastRow.Offset(7, 4).Value = " Total: "
LastRow.Offset(7, 5).Value = " " + TextBox9.Text
LastRow.Offset(8, 1).Value = "Question 5. " + TextBox10.Text
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub CommandButton3_Click()
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
TextBox9.Text = " "
TextBox10.Text = " "
OptionButton1.Value = False
OptionButton2.Value = False
OptionButton3.Value = False
OptionButton4.Value = False
OptionButton5.Value = False
OptionButton6.Value = False
OptionButton7.Value = False
OptionButton8.Value = False
OptionButton9.Value = False
OptionButton10.Value = False
OptionButton11.Value = False
End Sub
Private Sub Frame5_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub UserForm_Click()
End Su