Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want to set some (control toolbox-) Optionbuttons in a worksheet to "True". I retrieve the names of which Optionbuttons I want to set from another sheet, and put those names into an array of Strings. Finaly, can I loop the array and do a conversion from String to Optionbutton, and set them one by one to "True"? Here's my code so far: Public Sub TestNVTlist() Dim row, column As Integer Dim NVTlist() As String Dim NVT As String row = 2 column = 2 NVT = Trim(Sheet6.Cells(row, column).Value) Do While NVT < "" NVT = Trim(Sheet6.Cells(row, column).Value) ReDim Preserve NVTlist(column - 1) NVTlist(column - 1) = NVT column = column + 1 Loop Dim i As Integer Dim myStr As String For i = 1 To UBound(NVTlist) - 1 myStr = "Optionbutton" & Replace(NVTlist(i), ".", "_", , , vbTextCompare) & "_NVT" ' HERE I WANT TO DO A CONVERSION FROM "myStr" TO OPTIONBUTTON AND SET THE VALUE TO TRUE <<< Next End Sub Thx. Ludwig DV Kaprijke, Belgium |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ludwig
The basic syntax - ActiveSheet.OLEObjects("OptionButton1").Object.Val ue = True Note though OptionButtons are like radio buttons, only one can be true. However you could apply Null to multiple buttons. If you want sets of optionbuttons use those from the forms menu and look at "GroupName" in help. Otherwise maybe Checkboxes. Regards, Peter T wrote in message ups.com... Hi, I want to set some (control toolbox-) Optionbuttons in a worksheet to "True". I retrieve the names of which Optionbuttons I want to set from another sheet, and put those names into an array of Strings. Finaly, can I loop the array and do a conversion from String to Optionbutton, and set them one by one to "True"? Here's my code so far: Public Sub TestNVTlist() Dim row, column As Integer Dim NVTlist() As String Dim NVT As String row = 2 column = 2 NVT = Trim(Sheet6.Cells(row, column).Value) Do While NVT < "" NVT = Trim(Sheet6.Cells(row, column).Value) ReDim Preserve NVTlist(column - 1) NVTlist(column - 1) = NVT column = column + 1 Loop Dim i As Integer Dim myStr As String For i = 1 To UBound(NVTlist) - 1 myStr = "Optionbutton" & Replace(NVTlist(i), ".", "_", , , vbTextCompare) & "_NVT" ' HERE I WANT TO DO A CONVERSION FROM "myStr" TO OPTIONBUTTON AND SET THE VALUE TO TRUE <<< Next End Sub Thx. Ludwig DV Kaprijke, Belgium |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Control ToolBox OptionButtons? | Excel Discussion (Misc queries) | |||
Control ToolBox OptionButtons Printing? | Excel Discussion (Misc queries) | |||
reset control toolbox optionbuttons | Excel Programming | |||
Problem: Control Toolbox Control resizes when clicked | Excel Programming | |||
Controls Toolbox control vs Form Toolbox control | Excel Programming |