Thread: Radio Button
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default Radio Button

Hi

Thanks for the code you have provided. I have managed to get the radio
buttons working. I just had one more question, which I didn't receive a
reply for: How can i say to add any new entry to the next row everytime the
info is entered onto the form? I have added my code as it currently is
below. Thanking you in advance.

Private Sub BtnSaveInfo_Click()
Dim Sht As Worksheet

If Laptop1.Value = True Then
Set Sht = ThisWorkbook.Worksheets("Toshiba (00226)")
Sht.Range("A5").Value = TextBox2.Text
Sht.Range("B5").Value = RecDate.Text
Sht.Range("C5").Value = RSVers.Text
Sht.Range("D5").Value = CachVers.Text
Sht.Range("E5").Value = ApacVers.Text
Sht.Range("F5").Value = TomcVers.Text
Sht.Range("G5").Value = JavVers.Text
Sht.Range("H5").Value = TextBox1.Text

End If
If Laptop2.Value = True Then
Set Sht = ThisWorkbook.Worksheets("Dell (B000234)")
Sht.Range("A5").Value = TextBox2.Text
Sht.Range("B5").Value = RecDate.Text
Sht.Range("C5").Value = RSVers.Text
Sht.Range("D5").Value = CachVers.Text
Sht.Range("E5").Value = ApacVers.Text
Sht.Range("F5").Value = TomcVers.Text
Sht.Range("G5").Value = JavVers.Text
Sht.Range("H5").Value = TextBox1.Text
End If
End Sub



"JLGWhiz" wrote:

Had a typo in the first one. Use this set of code.

Private Sub OptionButton1_Click()
If Me.OptionButton1 = True Then
Sheets("Laptop 1").Activate
End If
End Sub

Private Sub OptionButton2_Click()
If Me.OptionButton2 = True Then
Sheets("Laptop 2").Activate
End If
End Sub




"zak" wrote:

Hi

I have a form with 2 radio buttons; one for Laptop 1 and the other for
Laptop 2. Also on the form are some text input fields which is generic to
both laptop 1 and 2.

My question is, based on the radio button selected, i'd like to copy the
information entered into the text fields on the form to the respective
worksheet (worksheet Laptop 1 or worksheet Laptop 2).

I'm not sure how to say If radio button 1 is selected,then write the info to
worksheet Laptop 1 or If radio button 2 is selected then write the info to
worksheet Laptop 2.

I look forward to any help. Thank you