View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sarasa[_6_] sarasa[_6_] is offline
external usenet poster
 
Posts: 1
Default excel vba programme

i have 10 questions. each question has 3 option button
if i select 1 option button for each quesiton it shoud store it in wor
sheet. but it does not. coudl you verify 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 = OptionButton1.Caption
Else
If OptionButton2.Value = True Then
LastRow.Offset(1, 1).Value = OptionButton2.Caption
Else
If OptionButton3.Value = True Then

LastRow.Offset(1, 1).Value = OptionButton3.Caption
End If
End If
End If

LastRow.Offset(1, 0).Value = OptionButton.CaptionTextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.Text


MsgBox "One record written to Sheet1"

response = MsgBox("Do you want to enter another record?", _
vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
OptionButton1.Value = False
OptionButton2.Value = False





TextBox1.SetFocus

Else
Unload Me
End If

End Sub


Private Sub CommandButton2_Click()
End

End Sub

Private Sub UserForm_Click()

End Su

--
Message posted from http://www.ExcelForum.com