PDA

View Full Version : Solved: Form Radio Buttons



Emoncada
04-06-2007, 11:29 AM
Hi I have this script that works just added 2 group of radio buttons and would like to know how I can make them work similiar to the code I already have.

I have this code


Private Sub CommandButton2_Click()
'Add New Button to your UserForm so you press to Apply Data to Sheet
Dim RowNext As Integer
'last row of data puls one row
RowNext = Worksheets("Server Build Template").Cells(65536, 1).End(xlUp).Row + 1
'Cells(Row Number,Column Number)
Worksheets("Server Build Template").Cells(RowNext, 1) = TxtName.Value
Worksheets("Server Build Template").Cells(RowNext, 2) = TxtDate.Value
Worksheets("Server Build Template").Cells(RowNext, 3) = TxtServerName.Value
Worksheets("Server Build Template").Cells(RowNext, 4) = TxtLocation.Value
Worksheets("Server Build Template").Cells(RowNext, 5) = TxtServerModel.Value

But Now TxtServerModel is now radio buttons no longer a TextBox. How can I get it to return what I want where I want it.

mdmackillop
04-06-2007, 01:00 PM
Hi Emoncada,
Welcome to VBAX
Can you post your userform in a workbook? Use Manage Attachments in the Go Advanced section.
Regards
MD

Emoncada
04-06-2007, 01:08 PM
This is the Workbook

Bob Phillips
04-06-2007, 01:34 PM
I think more info is required. Your workbook does nothing (for me), and rather than plough through all of the code, I respond better to b eing told what it des, what it doesn't do, what you want it to do, and what you have tried.

Emoncada
04-06-2007, 01:39 PM
It's pretty simple on what it does. You fill in the text boxes and when clicked the "Save & Close" Button it puts those values in the next available row, under the appropriate Column. I need help with the Radio Buttons. I don't know how to make those values go to the spreadsheet.
basically I have two pairs of radio buttons each pair belongs to a group.
So when form is filled out and radio buttons are selected I want the macro to know the Value that was selected and return it to the correct cell on the spreadsheet. Hope that helps.

mdmackillop
04-06-2007, 01:45 PM
Private Sub CommandButton2_Click()
'Add New Button to your UserForm so you press to Apply Data to Sheet
Dim RowNext As Integer
'last row of data puls one row
RowNext = Worksheets("Server Build Template").Cells(65536, 1).End(xlUp).Row + 1
'Cells(Row Number,Column Number)
With Worksheets("Server Build Template")
.Cells(RowNext, 1) = TxtName.Value
.Cells(RowNext, 2) = TxtDate.Value
.Cells(RowNext, 3) = TxtServerName.Value
.Cells(RowNext, 4) = TxtLocation.Value
If Me.OptionButton2 = True Then .Cells(RowNext, 5) = Me.LblML370G4.Caption
If Me.OptionButton1 = True Then .Cells(RowNext, 5) = Me.LblML370G5.Caption
.Cells(RowNext, 6) = TxtCtsContact.Value
.Cells(RowNext, 7) = TxtTracking.Value
If Me.Button72 = True Then .Cells(RowNext, 8) = Me.Lbl728GB.Caption
If Me.Button146 = True Then .Cells(RowNext, 8) = Me.Lbl146GB.Caption
.Cells(RowNext, 9) = TxtDrive1SN.Value
.Cells(RowNext, 10) = TxtDrive2SN.Value
.Cells(RowNext, 11) = TxtDrive3SN.Value
.Cells(RowNext, 12) = TxtDrive4SN.Value
.Cells(RowNext, 13) = TxtFinalStatus.Value
.Cells(RowNext, 14) = TxtSignature.Value
End With
ServerBuild.PrintForm
'You can't save a worksheet
ActiveWorkbook.Save
End Sub

Emoncada
04-06-2007, 01:58 PM
Perfect MdMackillop That worked Lovely. Thanks A Lot.

mdmackillop
04-06-2007, 02:15 PM
Glad to help.
You can mark this solved using the Thread Tools drop down.