vba-excel-training - creating new sheets
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and Help » vba-excel-training - Creating new sheets

vba-excel-training - Creating new sheets

The UK's most regular instructor-led training courses.
Training information: vba-excel-training · Excel/courses/london · VBA training in London

resolvedResolved · Low Priority · Version Standard

Creating new sheets

Tom has attended:
Excel VBA course

by - delegate Tom [1 post] (2007 Dec 3 Mon, 16:32) replyReply

Is it possible to have a userform from which more than one value can be picked, and then to create one sheet for every value?

Excel Advanced 1 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2002/XP 2008 Sep 10 Wed Tooting 0 FULL    
2003 2008 Sep 10 Wed Bloomsbury 5 book now £219 £235
2003 2008 Sep 12 Fri Southwark 5 book now £219 £235
2003 2008 Sep 17 Wed Southwark 0 FULL    
2003 2008 Sep 17 Wed Bayswater 5 book now £195 £205
2003 2008 Sep 19 Fri Bloomsbury 6 book now £214 £230
Full Schedule: See all 125 Excel Advanced course dates.
Bookings currently available until 24th November 2009.

RE: creating new sheets

by - trainer Carlos gold contributer[413 posts] (2007 Dec 10 Mon, 11:43) Edited on 2007 Dec 10 Mon, 11:46 replyReply

Hi Tom

The short answer to this is Yes.

The instructions below use object names I thought up as examples. You can change these names to suit your needs

You need to create a Form "frmNewSheets", with a List Box 'lstSheetNames" and a Button "cmdOK"

In the ListBox properties make sure MultiSelect is on 2 whiuch needs the Shift and Control buttons for multi selection

The in the code area for the m add the following code:

Private Sub cmdOK_Click() 'Takes the names from the list box an creates sheets with the names

Dim i As Integer 'Counts the number of items in the list

For i = 0 To lstSheetNames.ListCount - 1 'The -1 is needed as lists start at 0

If lstSheetNames.Selected(i) = True Then

Sheets.Add After:=Sheets(Sheets.Count) 'Add sheet at end
ActiveSheet.Name = lstSheetNames.List(i) 'Renames the sheet to the selected value

End If

Next i

End Sub
'==========================================
Private Sub UserForm_Initialize() 'Adds the names to the List Box

With Me.lstSheetNames

.AddItem "A"
.AddItem "B"
.AddItem "C"
.AddItem "D"
.AddItem "E"
.AddItem "F"

End With

End Sub


Hope this helps

Carlos


Related articles

· How to check for and reduce errors in Microsoft Excel
· Microsoft Excel Courses Teach Advanced Macro Techniques
· Basic Excel Training
· An Introduction to Microsoft Excel: Top Features for the Excel Novice
· Microsoft Excel Training: Not Just for Newbies Anymore

Excel tip:

Counting Blanks

Some times you want to check if there are cells missing data in your range. You can use the COUNTBLANK FUNCTION to acheive this. It is =COUNTBLANK(Range). Note Cells with formulas that return "" (empty text) are also counted. Cells with zero values are not counted.

View all Excel hints and tips

Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information
AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz