Create a vbCheckbox from code in vb command button

K

KJ MAN

This one may be for the pro's only.
I have a program button that will return values from another spreadsheet
and return them to a range on another sheet. I need my command button to
also create a vb checkbox or on off radio button beside each entry that it
copies.
Each time the button is pressed the number of returns will be different.
Users need to be able to select certain returned values and omit others and
then
process another button that will take the info from beside the selected
checkboxes
and copy it to another location.
 
K

KJ MAN

Thanks, Getting started now,

Chip Pearson said:
The following code should get you started. It creates 11 checkboxes in cells
B10:B20.

Sub AAA()
Dim N As Long
Dim CHK As Excel.CheckBox
Dim WS As Worksheet
Dim R As Range

Set WS = ThisWorkbook.Worksheets("Sheet1")
For N = 10 To 20
Set R = WS.Cells(N, "B")
Set CHK = WS.CheckBoxes.Add(Left:=R.Left, _
Top:=R.Top, _
Width:=R.Width, _
Height:=R.Height)
With CHK
.OnAction = "'" & ThisWorkbook.Name & "'!CheckBoxAction"
End With
Next N
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
K

KJ MAN

After these checkboxes are created, you still must manually program them
correct?
If so, Is there any way that they can be scripted from the code that creates
them?
I need them to be created after a search has been completed and when the
user clicks the ckeckbox, the checkbox will retrieve information from the
adjacent row.

Thanks for eveything chip//
 
K

KJ MAN

One more thing, I also need a code that will remove the checkboxes after
a process has been completed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top