PDA

View Full Version : inserting optButton value into worksheet



ironj32
02-09-2007, 01:11 PM
I've got a UserForm that is connected to another worksheet. I am having a problem figuring out the code for selecting the value of a option Button group the GroupName is "SelectOne". this is probably really easy. thanks!

Private Sub cmdSave_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("ContractWorkSheet")

'find first empty row in database
irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(irow, 1).Value = Me.txtUSBManager
ws.Cells(irow, 2).Value = Me.txtVendorName
ws.Cells(irow, 3).Value = Me.txtContractStartDate
ws.Cells(irow, 4).Value = Me.txtExpectedTerm
ws.Cells(irow, 5).Value = Me.txtExpectedValue
ws.Cells(irow, 6).Value = Me.GroupName.SelectOne


End Sub

Bob Phillips
02-09-2007, 01:21 PM
I think that you have to loop them



With Me.SelectOne
If .OptionButton1.Value Then
MsgBox 1
ElseIf .OptionButton2.Value Then
MsgBox 2
ElseIf .OptionButton3.Value Then
MsgBox 3
End If
End With

ironj32
02-09-2007, 01:32 PM
Thanks for the reply, but I am fairly new to this stuff...not sure how this would incoroporate adding the data to a worksheet?