ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual Basic Code (https://www.excelbanter.com/excel-programming/289958-visual-basic-code.html)

Robert Couchman

Visual Basic Code
 
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

Bob Phillips[_6_]

Visual Basic Code
 
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" wrote in
message ...
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




Tom Ogilvy

Visual Basic Code
 
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" wrote in
message ...
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





All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com