PC Review


Reply
Thread Tools Rate Thread

CommandCombo BOX want to populate all named ranges in it

 
 
vicky
Guest
Posts: n/a
 
      5th Jan 2010
Code Mention Below Populates all the sheetnames of the active workbook
in the combo box.... its not the combo box button its
COMMANDBARCOMBOBOX... now i want to a code snippet which should
populates all the named ranges in another COMMANDBARCOMBOBOX.. i am
newbie to vba.. so find this commandbar logic little complex.... hope
anyone can help me wit this.

Sub Auto_Open()

Dim cb As CommandBar
Dim ctrl As CommandBarControl
Dim ctrl1 As CommandBarControl
On Error Resume Next
Application.CommandBars("MyNavigator").Delete
On Error GoTo 0

Set cb = Application.CommandBars.Add(Name:="myNavigator",
temporary:=True)
With cb
.Visible = True
.RowIndex = msoBarRowLast
.Position = msoBarTop
Set ctrl = .Controls.Add(Type:=msoControlButton,
temporary:=True)
With ctrl
.Style = msoButtonCaption
.Caption = "Refresh Worksheet List"
.OnAction = "'" & ThisWorkbook.Name & "'!refreshthesheets"
End With
End Sub

Sub RefreshTheSheets()
Dim ctrl As CommandBarControl
Dim wks
Set ctrl = Application.CommandBars("myNavigator") _
.FindControl(Tag:="__wksnames__")
ctrl.Clear
For Each wks In ActiveWorkbook.Sheets
If wks.Visible = xlSheetVisible Then
ctrl.AddItem wks.Name
End If
Next wks
End Sub
 
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
Named ranges and pasting formulas with named references Dude3966 Microsoft Excel Programming 2 8th Oct 2008 04:15 PM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Microsoft Excel Programming 3 24th Dec 2007 01:15 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Microsoft Excel Programming 0 21st Aug 2006 03:51 PM
Populate a list box with named ranges..... Chris Salcedo Microsoft Excel Programming 2 23rd Oct 2005 06:06 AM
Like 123, allow named ranges, and print named ranges =?Utf-8?B?V1A=?= Microsoft Excel Misc 1 8th Apr 2005 06:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:06 PM.