Jul 27th, 2005, 11:19 AM
#1
Thread Starter
PowerPoster
show sheets into userform...
Assuming i have many sheet into a wbook, named GENNAIO_2004, FEBBRAIO_2005, MARZO_2003 etcc....
Is possible to show into a userform the list of all sheet and when i click on one of this, select and show the selected sheet?
note:
into wbook i have also a shett named "controllo" and "abicab" in effect for me is important only to show the sheets na,med with MONTH and YEAR.
Jul 27th, 2005, 11:21 AM
#2
Re: show sheets into userform...
How are you displaying these on the userform, in a listbox?
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
Jul 27th, 2005, 11:38 AM
#3
Thread Starter
PowerPoster
Re: show sheets into userform...
Originally Posted by
dannymking
How are you displaying these on the userform, in a listbox?
I am sorry into userform with the tipical drag bar with arrow up/down...
Jul 27th, 2005, 11:46 AM
#4
Re: show sheets into userform...
You can do something like this to generate a string listing of all sheets.
VB Code:
Public Function ListSheets() As String
Dim sSheets As String
Dim i As Integer
For i = 1 To ActiveWorkbook.Sheets.Count
sSheets = sSheets & ActiveWorkbook.Sheets(i).Name & ";"
Next
ListSheets = Left$(sSheets, Len(sSheets) - 1)
End Function
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 27th, 2005, 11:47 AM
#5
Jul 27th, 2005, 11:52 AM
#6
Re: show sheets into userform...
Then you can load your userform with this code behind it. The UF contains a combobox control which is probably best to use in this situation.
VB Code:
Private Sub UserForm_Initialize()
Dim ar() As String
Dim i As Integer
ar = Split(ThisWorkbook.ListSheets, ";")
For i = 0 To UBound(ar)
ComboBox1.AddItem ar(i)
Next
Erase ar
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 27th, 2005, 11:55 AM
#7
Re: show sheets into userform...
This would be the complete code behind the userform.
VB Code:
Option Explicit
Private Sub ComboBox1_Click()
ActiveWorkbook.Sheets(ComboBox1.ListIndex + 1).Activate
End Sub
Private Sub UserForm_Initialize()
Dim ar() As String
Dim i As Integer
ar = Split(ThisWorkbook.ListSheets, ";")
For i = 0 To UBound(ar)
ComboBox1.AddItem ar(i)
Next
Erase ar
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 27th, 2005, 11:59 AM
#8
Re: show sheets into userform...
Also add this code behind the userform for when the user types in the sheet name to switch to.
VB Code:
Private Sub ComboBox1_Change()
ActiveWorkbook.Sheets(ComboBox1.ListIndex + 1).Activate
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 27th, 2005, 11:59 AM
#9
Thread Starter
PowerPoster
Re: show sheets into userform...
Originally Posted by
RobDog888
This would be the complete code behind the userform.
VB Code:
Option Explicit
Private Sub ComboBox1_Click()
ActiveWorkbook.Sheets(ComboBox1.ListIndex + 1).Activate
End Sub
Private Sub UserForm_Initialize()
Dim ar() As String
Dim i As Integer
ar = Split(ThisWorkbook.ListSheets, ";")
For i = 0 To UBound(ar)
ComboBox1.AddItem ar(i)
Next
Erase ar
End Sub
tks RobDog888 but i am a new bie not is possible to attach an example?
Tks and pizza for you.
Sal from Napoli.
Last edited by luca90; Jul 27th, 2005 at 12:03 PM .
Jul 27th, 2005, 12:20 PM
#10
Re: show sheets into userform...
Ok, here is a complete working example.
Attached Files
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 27th, 2005, 03:57 PM
#11
Thread Starter
PowerPoster
Re: show sheets into userform...
Originally Posted by
RobDog888
Ok, here is a complete working example.
Hi Rob, tks for code... work fine.
But have an idea for this:
http://www.vbforums.com/showthread.php?t=351557
Very important for me.
Tks 2 pizza from Napoli.
Jul 27th, 2005, 04:22 PM
#12
Re: show sheets into userform...
Havent done much with automating IE but I will take a deeper look later. I need to take care of something.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 28th, 2005, 02:11 AM
#13
Thread Starter
PowerPoster
Re: show sheets into userform...
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width