PC Review


Reply
Thread Tools Rate Thread

control toolbar combo box and command button

 
 
=?Utf-8?B?bWFpaml1bGk=?=
Guest
Posts: n/a
 
      14th Aug 2007
Hello,

I'm interested in using a combo box and command button from the control
toolbar. The combo box will contain the names of all the worksheets in this
file. This is done with a dynamic named range. The command button will act
like a "submit" button to take the user to the desired worksheet selected
from the combo box.

The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
Is there a way to do this?

Thanks in advance,

MJ
--
Thank You!
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      14th Aug 2007
I'm not sure where you are running your controls from (a userform or the
spreadsheet directly), so where you put this is up in the air. Here, I have
assumed that you have a userform, so I placed it in the Activate event for
that userform...

Private Sub UserForm_Activate()
Dim SH As Worksheet
If ComboBox1.ListCount = 0 Then
For Each SH In Worksheets
ComboBox1.AddItem SH.Name
Next
End If
End Sub

If the ComboBox has nothing in it, the above code will populate it with the
worksheet names. Put this in the CommandButton's Click event to select the
worksheet name in the ComboBox...

Private Sub CommandButton1_Click()
If Len(ComboBox1.Text) Then
Worksheets(ComboBox1.Text).Activate
Else
MsgBox "Please select a worksheet to go to."
End If
End Sub

Rick

"maijiuli" <(E-Mail Removed)> wrote in message
news:756E1837-3058-43DB-8BF4-(E-Mail Removed)...
> Hello,
>
> I'm interested in using a combo box and command button from the control
> toolbar. The combo box will contain the names of all the worksheets in
> this
> file. This is done with a dynamic named range. The command button will
> act
> like a "submit" button to take the user to the desired worksheet selected
> from the combo box.
>
> The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> Is there a way to do this?
>
> Thanks in advance,
>
> MJ
> --
> Thank You!


 
Reply With Quote
 
=?Utf-8?B?bWFpaml1bGk=?=
Guest
Posts: n/a
 
      14th Aug 2007
Thank you Mr. Rothstein. My controls are placed directly on the spreadsheet
so I put your codes into the Combo Box change and Command button click areas
of the VB editor. Thank you so much!
--
Thank You!


"Rick Rothstein (MVP - VB)" wrote:

> I'm not sure where you are running your controls from (a userform or the
> spreadsheet directly), so where you put this is up in the air. Here, I have
> assumed that you have a userform, so I placed it in the Activate event for
> that userform...
>
> Private Sub UserForm_Activate()
> Dim SH As Worksheet
> If ComboBox1.ListCount = 0 Then
> For Each SH In Worksheets
> ComboBox1.AddItem SH.Name
> Next
> End If
> End Sub
>
> If the ComboBox has nothing in it, the above code will populate it with the
> worksheet names. Put this in the CommandButton's Click event to select the
> worksheet name in the ComboBox...
>
> Private Sub CommandButton1_Click()
> If Len(ComboBox1.Text) Then
> Worksheets(ComboBox1.Text).Activate
> Else
> MsgBox "Please select a worksheet to go to."
> End If
> End Sub
>
> Rick
>
> "maijiuli" <(E-Mail Removed)> wrote in message
> news:756E1837-3058-43DB-8BF4-(E-Mail Removed)...
> > Hello,
> >
> > I'm interested in using a combo box and command button from the control
> > toolbar. The combo box will contain the names of all the worksheets in
> > this
> > file. This is done with a dynamic named range. The command button will
> > act
> > like a "submit" button to take the user to the desired worksheet selected
> > from the combo box.
> >
> > The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> > Is there a way to do this?
> >
> > Thanks in advance,
> >
> > MJ
> > --
> > Thank You!

>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      14th Aug 2007
Maybe you could use something like:
http://contextures.com/xlToolbar01.html

maijiuli wrote:
>
> Hello,
>
> I'm interested in using a combo box and command button from the control
> toolbar. The combo box will contain the names of all the worksheets in this
> file. This is done with a dynamic named range. The command button will act
> like a "submit" button to take the user to the desired worksheet selected
> from the combo box.
>
> The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> Is there a way to do this?
>
> Thanks in advance,
>
> MJ
> --
> Thank You!


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?bWFpaml1bGk=?=
Guest
Posts: n/a
 
      15th Aug 2007
Dave or should I say Sir Peterson, you are a genious. I can't thank you
enough for this one.

MJ
--
Thank You!


"Dave Peterson" wrote:

> Maybe you could use something like:
> http://contextures.com/xlToolbar01.html
>
> maijiuli wrote:
> >
> > Hello,
> >
> > I'm interested in using a combo box and command button from the control
> > toolbar. The combo box will contain the names of all the worksheets in this
> > file. This is done with a dynamic named range. The command button will act
> > like a "submit" button to take the user to the desired worksheet selected
> > from the combo box.
> >
> > The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> > Is there a way to do this?
> >
> > Thanks in advance,
> >
> > MJ
> > --
> > Thank You!

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
=?Utf-8?B?bWFpaml1bGk=?=
Guest
Posts: n/a
 
      15th Aug 2007
Sire, is there a way to change your Navigation toolbar to live only in a
specific file.

I've been playing around with it for a couple hours now and it works great
but when I open other files the Navigation Toolbar always pops up in the
floating method.

To share this with my company I need the toolbar to either live in only one
file so it does not disrupt others files.

OR

If we can find a way to change the macro so it is not in the float position
on open. Maybe if the macro can be changed to live with all the other
toolbars on top when a file is open then this would probably be ok. At least
this way it is not in the way to the other users who want to use this addin.

Sorry if I'm asking for too much but it's too good to let go,


--
Thank You!


"Dave Peterson" wrote:

> Maybe you could use something like:
> http://contextures.com/xlToolbar01.html
>
> maijiuli wrote:
> >
> > Hello,
> >
> > I'm interested in using a combo box and command button from the control
> > toolbar. The combo box will contain the names of all the worksheets in this
> > file. This is done with a dynamic named range. The command button will act
> > like a "submit" button to take the user to the desired worksheet selected
> > from the combo box.
> >
> > The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> > Is there a way to do this?
> >
> > Thanks in advance,
> >
> > MJ
> > --
> > Thank You!

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Aug 2007
I wouldn't put it a specific workbook. The point of the refresh button is so
that you can change workbooks and click that button and use it there. (Or
add/delete worksheets and refresh the list.)

Personally, I liked to make that toolbar appear in the worksheet. By floating
it over the worksheet, the user has a better chance of noticing it. They can
always reposition it where they want--either by dragging it or by double
clicking on the title bar.

But you can dock it if you add a couple of lines of code:

With cb
.Visible = True
.RowIndex = msoBarRowLast '<-- Added
.Position = msoBarTop '<-- Added

========
I'd keep this code separate from every other workbook, too. I'd put it in a
dedicated workbook and save it as an addin. Then just load it on demand, or put
it in my XLStart folder, or use Tools|Addins to install it.



maijiuli wrote:
>
> Sire, is there a way to change your Navigation toolbar to live only in a
> specific file.
>
> I've been playing around with it for a couple hours now and it works great
> but when I open other files the Navigation Toolbar always pops up in the
> floating method.
>
> To share this with my company I need the toolbar to either live in only one
> file so it does not disrupt others files.
>
> OR
>
> If we can find a way to change the macro so it is not in the float position
> on open. Maybe if the macro can be changed to live with all the other
> toolbars on top when a file is open then this would probably be ok. At least
> this way it is not in the way to the other users who want to use this addin.
>
> Sorry if I'm asking for too much but it's too good to let go,
>
> --
> Thank You!
>
> "Dave Peterson" wrote:
>
> > Maybe you could use something like:
> > http://contextures.com/xlToolbar01.html
> >
> > maijiuli wrote:
> > >
> > > Hello,
> > >
> > > I'm interested in using a combo box and command button from the control
> > > toolbar. The combo box will contain the names of all the worksheets in this
> > > file. This is done with a dynamic named range. The command button will act
> > > like a "submit" button to take the user to the desired worksheet selected
> > > from the combo box.
> > >
> > > The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> > > Is there a way to do this?
> > >
> > > Thanks in advance,
> > >
> > > MJ
> > > --
> > > Thank You!

> >
> > --
> >
> > Dave Peterson
> >


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?bWFpaml1bGk=?=
Guest
Posts: n/a
 
      15th Aug 2007
Brilliant! Thanks again Sir.
--
Thank You!


"Dave Peterson" wrote:

> I wouldn't put it a specific workbook. The point of the refresh button is so
> that you can change workbooks and click that button and use it there. (Or
> add/delete worksheets and refresh the list.)
>
> Personally, I liked to make that toolbar appear in the worksheet. By floating
> it over the worksheet, the user has a better chance of noticing it. They can
> always reposition it where they want--either by dragging it or by double
> clicking on the title bar.
>
> But you can dock it if you add a couple of lines of code:
>
> With cb
> .Visible = True
> .RowIndex = msoBarRowLast '<-- Added
> .Position = msoBarTop '<-- Added
>
> ========
> I'd keep this code separate from every other workbook, too. I'd put it in a
> dedicated workbook and save it as an addin. Then just load it on demand, or put
> it in my XLStart folder, or use Tools|Addins to install it.
>
>
>
> maijiuli wrote:
> >
> > Sire, is there a way to change your Navigation toolbar to live only in a
> > specific file.
> >
> > I've been playing around with it for a couple hours now and it works great
> > but when I open other files the Navigation Toolbar always pops up in the
> > floating method.
> >
> > To share this with my company I need the toolbar to either live in only one
> > file so it does not disrupt others files.
> >
> > OR
> >
> > If we can find a way to change the macro so it is not in the float position
> > on open. Maybe if the macro can be changed to live with all the other
> > toolbars on top when a file is open then this would probably be ok. At least
> > this way it is not in the way to the other users who want to use this addin.
> >
> > Sorry if I'm asking for too much but it's too good to let go,
> >
> > --
> > Thank You!
> >
> > "Dave Peterson" wrote:
> >
> > > Maybe you could use something like:
> > > http://contextures.com/xlToolbar01.html
> > >
> > > maijiuli wrote:
> > > >
> > > > Hello,
> > > >
> > > > I'm interested in using a combo box and command button from the control
> > > > toolbar. The combo box will contain the names of all the worksheets in this
> > > > file. This is done with a dynamic named range. The command button will act
> > > > like a "submit" button to take the user to the desired worksheet selected
> > > > from the combo box.
> > > >
> > > > The names of the worksheets are like: Aetna, Blue Shield, Pacificare, etc.
> > > > Is there a way to do this?
> > > >
> > > > Thanks in advance,
> > > >
> > > > MJ
> > > > --
> > > > Thank You!
> > >
> > > --
> > >
> > > Dave Peterson
> > >

>
> --
>
> Dave Peterson
>

 
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
Command Button to Use Toolbar Find prog1 Microsoft Access Forms 1 1st Apr 2010 05:19 PM
Command Button for Macro on a Toolbar =?Utf-8?B?T2ZmaWNlIEp1bmlvcg==?= Microsoft Excel Misc 7 12th May 2007 04:48 PM
Command Button for Macro on the Toolbar =?Utf-8?B?T2ZmaWNlIEp1bmlvcg==?= Microsoft Excel New Users 1 11th May 2007 12:48 PM
Toolbar - add a graphic to the command button =?Utf-8?B?TWlrZSBGYXVsa25lcg==?= Microsoft Word Document Management 1 20th Mar 2007 09:43 AM
Trying to put a Command Button into a Toolbar for a Template =?Utf-8?B?R0xU?= Microsoft Word Document Management 3 25th Mar 2005 08:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:53 AM.