Visual Basic Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I am currently working on a project to transfer application forms to a spread sheet, so far i have been able to add all data, but i am looking for a piece of program that will allow me to use a group of radio boxes (option boxes) to output a number rather than having the same number of cells and true only apearing in one of them

thank you

Robert Couchman
 
Robert,

This adds 5 option buttons

For i = 1 To 5
With ActiveSheet.OLEObjects
Set oCtl = .Add(ClassType:="Forms.OptionButton.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=500, _
Top:=60 * i, _
Width:=200, _
Height:=32)
oCtl.Object.Caption = "Option " & CStr(i)
End With
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Robert Couchman said:
Hi,
I am currently working on a project to transfer application forms to a
spread sheet, so far i have been able to add all data, but i am looking for
a piece of program that will allow me to use a group of radio boxes (option
boxes) to output a number rather than having the same number of cells and
true only apearing in one of them.
 
Assuming optionbuttons are in a userform you could do something like this.
(don't tie any of the buttons to a cell)
i = 0
for each ct in me.Controls
if typeof ct is MSForms.OptionButton then
i = i + 1
if ct.Value then
Range("Whatever").Value = i
exist for
end if
end if
Next

--
Regards,
Tom Ogilvy


Robert Couchman said:
Hi,
I am currently working on a project to transfer application forms to a
spread sheet, so far i have been able to add all data, but i am looking for
a piece of program that will allow me to use a group of radio boxes (option
boxes) to output a number rather than having the same number of cells and
true only apearing in one of them.
 
Back
Top