Tejas Kore
Board Regular
- Joined
- Nov 2, 2017
- Messages
- 72
- Office Version
- 365
- Platform
- Windows
Hi Friends,
I have some data in first column of my excel sheet.I want to display that data to user through checkboxes and then let user check the required data . After that I want to paste the selected data in the column adjacent to it.
I am unable to loop through checkboxes because everything everything is done dynamically and even I have created userfom programaticaly.
Here is my code for generating checkboxes.
'LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
'For i = 2 To LastRow
' Set NewCheckBox = myForm.designer.Controls.Add("Forms.CheckBox.1", "CheckBox_" & i)
' NewCheckBox.Caption = Worksheets("Sheet1").Cells(i, 1).Value
' NewCheckBox.Left = 5
' NewCheckBox.Top = 5 + ((i - 1) * 20)
'Next i
Can anyone suggest me how to loop through these checkboxes as I used ' "CheckBox_" & i ' while looping and then vbe started giving error. Because you should use Checkbox_1.Name for using '.' operator but if you do the same thing on strings it won't support , I guess.
This code I want write for a command button which will copy/transfer checked data to the adjacent column.
I have some data in first column of my excel sheet.I want to display that data to user through checkboxes and then let user check the required data . After that I want to paste the selected data in the column adjacent to it.
I am unable to loop through checkboxes because everything everything is done dynamically and even I have created userfom programaticaly.
Here is my code for generating checkboxes.
'LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
'For i = 2 To LastRow
' Set NewCheckBox = myForm.designer.Controls.Add("Forms.CheckBox.1", "CheckBox_" & i)
' NewCheckBox.Caption = Worksheets("Sheet1").Cells(i, 1).Value
' NewCheckBox.Left = 5
' NewCheckBox.Top = 5 + ((i - 1) * 20)
'Next i
Can anyone suggest me how to loop through these checkboxes as I used ' "CheckBox_" & i ' while looping and then vbe started giving error. Because you should use Checkbox_1.Name for using '.' operator but if you do the same thing on strings it won't support , I guess.
This code I want write for a command button which will copy/transfer checked data to the adjacent column.