Radio Button
Thank you both for your responses. Your code has been a great help! Thank you
I have now got it to work, but have another relating question. Please see
my code below and let me know how i can say to add a new row everytime the
form is used and not just rewrite over A5,B5,C5,D5 etc.
Private Sub BtnSaveInfo_Click()
Dim Sht As Worksheet
If Laptop1.Value = True Then
Set Sht = ThisWorkbook.Worksheets("Demo Laptop 1")
Sht.Range("A5").Value = TextBox2.Text
Sht.Range("B5").Value = RecDate.Text
Sht.Range("C5").Value = RSVers.Text
Sht.Range("D5").Value = CachVers.Text
End If
If Laptop2.Value = True Then
Set Sht = ThisWorkbook.Worksheets("Demo Laptop 2")
Sht.Range("A5").Value = TextBox2.Text
Sht.Range("B5").Value = RecDate.Text
Sht.Range("C5").Value = RSVers.Text
Sht.Range("D5").Value = CachVers.Text
End If
End Sub
Thanking you in advance.
"Howard31" wrote:
Hi zak,
Let me put in steps what you should do. I hope this will help
1. Put a Button control on the Userform
2. Name the Button BtnSaveInfo
3 Change the Caption of the button to something descriptive maybe 'Save' or
'Save Info'
4. Double click the button
5. enter the follwing code in step 6 between the follwing code lines
Private Sub BtnSaveInfo_Click()
End Sub
6. Code to enter behind the button
Dim Sht As Worksheet
If OptionButton1.Value = True Then
Set Sht = ThisWorkbook.Worksheets("Laptop1")
Else
Set Sht = ThisWorkbook.Worksheets("Laptop2")
End If
Sht.Range("A1").Value = TextBox1.Text
Hope this helps,
--
A. Ch. Eirinberg
"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
|