PC Review


Reply
Thread Tools Rate Thread

Create a vbCheckbox from code in vb command button

 
 
KJ MAN
Guest
Posts: n/a
 
      14th Sep 2008
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.
 
Reply With Quote
 
 
 
 
KJ MAN
Guest
Posts: n/a
 
      15th Sep 2008
Thanks, Getting started now,

"Chip Pearson" wrote:

> 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)
>
>
>
>
> "KJ MAN" <(E-Mail Removed)> wrote in message
> news2435CED-D849-4914-A831-(E-Mail Removed)...
> > 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.

>

 
Reply With Quote
 
KJ MAN
Guest
Posts: n/a
 
      15th Sep 2008
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//

"Chip Pearson" wrote:

> 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)
>
>
>
>
> "KJ MAN" <(E-Mail Removed)> wrote in message
> news2435CED-D849-4914-A831-(E-Mail Removed)...
> > 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.

>

 
Reply With Quote
 
KJ MAN
Guest
Posts: n/a
 
      16th Sep 2008
One more thing, I also need a code that will remove the checkboxes after
a process has been completed.

"KJ MAN" wrote:

> 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//
>
> "Chip Pearson" wrote:
>
> > 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)
> >
> >
> >
> >
> > "KJ MAN" <(E-Mail Removed)> wrote in message
> > news2435CED-D849-4914-A831-(E-Mail Removed)...
> > > 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.

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to Create a Command Button ianmacinnis@gmail.com Microsoft Excel Programming 0 13th Sep 2007 03:37 PM
Wanting to Create A Command Button Command =?Utf-8?B?YnVtcGVyMzM4?= Microsoft Excel Programming 3 7th May 2007 06:53 PM
How to create a command button to do... =?Utf-8?B?a2lt?= Microsoft Access Forms 3 27th Jul 2006 05:52 PM
Executing C code from a Command Button's code =?Utf-8?B?bmpj?= Microsoft Word Document Management 1 19th Apr 2004 10:38 PM
Re: Create Command Button from Code Bruce B Microsoft Excel Programming 0 14th Jul 2003 02:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:35 AM.