Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a spreadsheet with a list of values in column Y that I want to
show up as checkboxes on a userform. The current code crashes when it tries to add a caption to the checkbox. I get a runtime error "Could not find the specified object" The actual code would call a function to determine how many rows in column Y which will vary, and I'll add code to size the form and manipulate the checkboxes to fit. Private Sub UserForm_Initialize() Dim iRow As Integer Dim iLeft As Integer Dim ctlCheckBox As Control Dim sName As String dim iNumRows as integer Worksheets("ModelList").Activate iTop = 10 For iRow = 2 To iNumRows If Cells(iRow, "Y") < "" Then Set ctlCheckBox = frmEditBom.Controls.Add("Forms.CheckBox.1", "cb" & iRow) sName = "cb" & iRow 'I tried using ctlCheckBox sub for sName-same result frmEditBom! sName.Caption = Cells(iRow, "Y") frmEditBom!sName.Left = iLeft frmEditBom!sName.Top = iTop iTop = iTop + 10 End If Next iRow End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple checkboxes and aligning | Excel Discussion (Misc queries) | |||
Multiple Checkboxes | Excel Discussion (Misc queries) | |||
Userform Checkboxes | Excel Discussion (Misc queries) | |||
Userform with Checkboxes | Excel Discussion (Misc queries) | |||
How to create in a userform, select all/deselect all checkboxes | Excel Programming |