Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default combo box with sheet names

I want to create a combo box with sheetnames of w/book.how?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default combo box with sheet names

One way is to load the combobox with the sheet names as the workbook opens,
the example fills the ComboBox1 on worksheet 1 e.g..


Private Sub Workbook_Open()
Dim ws As Integer
With Sheets(1).ComboBox1
For ws = 1 To Sheets.Count
.AddItem Sheets(ws).Name
Next
End With
End Sub

--
Cheers
Nigel



"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:5dc4602d21ce9@uwe...
I want to create a combo box with sheetnames of w/book.how?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default combo box with sheet names

thanks Nigel,I am sorry I put my question wrong,load a combo box with sheet
names in a userform,in w/sheet 1.

Nigel wrote:
One way is to load the combobox with the sheet names as the workbook opens,
the example fills the ComboBox1 on worksheet 1 e.g..

Private Sub Workbook_Open()
Dim ws As Integer
With Sheets(1).ComboBox1
For ws = 1 To Sheets.Count
.AddItem Sheets(ws).Name
Next
End With
End Sub

I want to create a combo box with sheetnames of w/book.how?


--
Message posted via http://www.officekb.com
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default combo box with sheet names

On a userform add the code into the Userform initialize event e.g.

Private Sub UserForm_Initialize()
Dim ws As Integer
For ws = 1 To Sheets.Count
ComboBox1.AddItem Sheets(ws).Name
Next
End Sub

--
Cheers
Nigel



"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:5dc525ca3b37a@uwe...
thanks Nigel,I am sorry I put my question wrong,load a combo box with
sheet
names in a userform,in w/sheet 1.

Nigel wrote:
One way is to load the combobox with the sheet names as the workbook
opens,
the example fills the ComboBox1 on worksheet 1 e.g..

Private Sub Workbook_Open()
Dim ws As Integer
With Sheets(1).ComboBox1
For ws = 1 To Sheets.Count
.AddItem Sheets(ws).Name
Next
End With
End Sub

I want to create a combo box with sheetnames of w/book.how?


--
Message posted via http://www.officekb.com



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default combo box with sheet names

thanks Nigel,Its working fine,but after saving this w/book with this code ,
while reopening this w/book ,I am unable to locate my userform in any of my
w/book sheets.It is not visible anywhere.

Nigel wrote:
On a userform add the code into the Userform initialize event e.g.

Private Sub UserForm_Initialize()
Dim ws As Integer
For ws = 1 To Sheets.Count
ComboBox1.AddItem Sheets(ws).Name
Next
End Sub

thanks Nigel,I am sorry I put my question wrong,load a combo box with
sheet

[quoted text clipped - 14 lines]

I want to create a combo box with sheetnames of w/book.how?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default combo box with sheet names

Modify your Workbook_Open Code as follows:

Private Sub Workbook_Open()
Dim ws As Integer
With Sheets(1).ComboBox1
For ws = 1 To Sheets.Count
.AddItem Sheets(ws).Name
Next
End With
UserFormName.show '<<< Change to actual UF Name
End Sub



"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:5dc7db7ec9a1d@uwe...
thanks Nigel,Its working fine,but after saving this w/book with this code
,
while reopening this w/book ,I am unable to locate my userform in any of
my
w/book sheets.It is not visible anywhere.

Nigel wrote:
On a userform add the code into the Userform initialize event e.g.

Private Sub UserForm_Initialize()
Dim ws As Integer
For ws = 1 To Sheets.Count
ComboBox1.AddItem Sheets(ws).Name
Next
End Sub

thanks Nigel,I am sorry I put my question wrong,load a combo box with
sheet

[quoted text clipped - 14 lines]

I want to create a combo box with sheetnames of w/book.how?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default combo box with sheet names

Did you save it in the Personal.xls hidden workbook. Take a look in the VB
editor and see if it is there, you can drag it across.

--
Cheers
Nigel



"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:5dc7db7ec9a1d@uwe...
thanks Nigel,Its working fine,but after saving this w/book with this code
,
while reopening this w/book ,I am unable to locate my userform in any of
my
w/book sheets.It is not visible anywhere.

Nigel wrote:
On a userform add the code into the Userform initialize event e.g.

Private Sub UserForm_Initialize()
Dim ws As Integer
For ws = 1 To Sheets.Count
ComboBox1.AddItem Sheets(ws).Name
Next
End Sub

thanks Nigel,I am sorry I put my question wrong,load a combo box with
sheet

[quoted text clipped - 14 lines]

I want to create a combo box with sheetnames of w/book.how?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sheet Referencing - autofilling sheet names Pat Excel Worksheet Functions 2 June 4th 09 03:50 AM
Cell names = sheet names Vince Excel Worksheet Functions 9 February 8th 08 03:59 PM
return all worksheet tab names and chart sheet tab names in report - an example DataFreakFromUtah Excel Programming 2 October 6th 04 08:09 PM
Loading Sheet Names into Combo Box ExcelMonkey[_156_] Excel Programming 6 September 15th 04 01:30 PM
VBA for opening file/populating combo box with sheet names Sinobato[_4_] Excel Programming 3 July 26th 04 06:35 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"