Excel Vba Clarification

C

Charles

sarasa


Here is my version of your primary code. It should not over typ
previous record.
Copy this to your pgm to see if it works for you.
Be sure you backup your pgm before you try.
Charles





Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim LastRow As Range
Set LastRow = Sheet1.Range("b65536").End(xlUp)
With UserForm1
If OptionButton1.Value = True Then
LastRow.Offset(1, 0).Value = "Question 1. "
OptionButton1.Caption
ElseIf OptionButton2.Value = True Then
LastRow.Offset(1, 0).Value = "Question 1. "
OptionButton2.Caption
ElseIf OptionButton3.Value = True Then
LastRow.Offset(1, 0).Value = "Question 1. "
OptionButton3.Caption
End If
If OptionButton4.Value = True Then
LastRow.Offset(2, 0).Value = "Question 2. "
OptionButton4.Caption
ElseIf OptionButton5.Value = True Then
LastRow.Offset(2, 0).Value = "Question 2. "
OptionButton5.Caption
ElseIf OptionButton6.Value = True Then
LastRow.Offset(2, 0).Value = "Question 2. "
OptionButton6.Caption
End If
If OptionButton7.Value = True Then
LastRow.Offset(3, 0).Value = "Question 3. "
OptionButton7.Caption
ElseIf OptionButton8.Value = True Then
LastRow.Offset(3, 0).Value = "Question 3. "
OptionButton8.Caption
ElseIf OptionButton9.Value = True Then
LastRow.Offset(3, 0).Value = "Question 3. "
OptionButton9.Caption
ElseIf OptionButton10.Value = True Then
LastRow.Offset(3, 0).Value = "Question 3. "
OptionButton10.Caption
ElseIf OptionButton11.Value = True Then
LastRow.Offset(3, 0).Value = "Question 3. Other"
LastRow.Offset(3, 2).Value = TextBox1.Text & " Months"
End If
If OptionButton11.Value = False Then
LastRow.Offset(3, 3).Value = " "
End If
With LastRow
.Offset(4, 0).Value = "Question 4. " & TextBox2.Text
.Offset(4, 1).Value = "Physician: "
.Offset(4, 2).Value = " " & TextBox2.Text
.Offset(5, 1).Value = " NP/RN: "
.Offset(5, 2).Value = " " & TextBox3.Text
.Offset(6, 1).Value = " Other: "
.Offset(6, 2).Value = " " & TextBox4.Text
.Offset(7, 1).Value = " Total: "
.Offset(7, 2).Value = " " & TextBox5.Text
.Offset(4, 3).Value = " Salary: "
.Offset(4, 4).Value = " " & TextBox6.Text
.Offset(5, 3).Value = "Operational: "
.Offset(5, 4).Value = " " & TextBox7.Text
.Offset(6, 3).Value = " Capital: "
.Offset(6, 4).Value = " " & TextBox8.Text
.Offset(7, 3).Value = " Total: "
.Offset(7, 4).Value = " " & TextBox9.Text
.Offset(8, 0).Value = "Question 5. " & TextBox10.Text
End With
End With
End Su
 
S

sarasa

Dear Charles
It works perfectly your code. Thank you very much. Could you tellme ca
i iinclude scroll bar., so that i can add two more qeustons in on
form
 
S

sarasa

Hi Charles,
I did larger form. But when you run through macro it does not showup
scrollbar. I did in form properties vertical scrollbar . though it is
not show up. how can i see full for?
Please explain to me
or send email to me (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top