building forms
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Building Forms

Building Forms

resolvedResolved · Medium Priority · Version 2003

replyReplyTue 27 Jul 2010, 16:46Delegate Babawande said...

Building Forms

I attended VBA Introduction-Intermediate training programme last week; I have a question concerning the exercise we did in class.

Below is an extract from the exercise, this relates to building “forms”.

-------------------------------------------------------------------------------------------------------
Private Sub cmbRepType_AfterUpdate()

Dim IntRowCount As Integer
Dim intIndex As Integer

intIndex = 0

Call DeleteEntries

If Me.cmbRepType.Value = "Sales Person Report" Then

For IntRowCount = 2 To Sheets("List Page").Range("a1").CurrentRegion. _
Rows.Count

Me.cmbSelection.AddItem Sheets("List Page").Cells(IntRowCount, 1).Value, _
intIndex

intIndex = intIndex + 1

Next IntRowCount


Else

For IntRowCount = 2 To Sheets("List Page").Range("c1").CurrentRegion. _
Rows.Count

Me.cmbSelection.AddItem Sheets("List Page").Cells(IntRowCount, 3).Value, _
intIndex

intIndex = intIndex + 1

Next IntRowCount

End If

End Sub

-------------------------------------------------------------------------------------------------------
Sub DeleteEntries()

Dim IntRowCount As Integer

For IntRowCount = Me.cmbSelection.ListCount - 1 To 0 Step -1

Me.cmbSelection.RemoveItem IntRowCount

Next IntRowCount

End Sub

--------------------------------------------------------------------------------------------

I noticed that running the code, with or without “DeleteEntries”, (that is, not calling “DeleteEntries” from procedure: “cmbRepType_AfterUpdate”) does not make a difference to the final result.

In future, if I want to build a similar model, must I include “DeleteEntries” code?

Kind regards


Wande

For upcoming training course dates see: Pricing & availability

replyReplyWed 28 Jul 2010, 10:47Trainer Stephen said...

RE: Building Forms

Hi Wande

Thanks for your question

The fact that the deleteentries procedure seems to make no difference is down to the fact that we are explicitly specifying the index number of each entry; thus it overwrites the corresponding entry.
However, it cannot be guaranteed that the index numbers will always be equal, and thus it is good practice to include the DeleteEntries procedure

Regards

Stephen

Tue 3 Aug 2010: Automatically marked as resolved.

 

 

Please browse our web site to find out more about
excel consulting and other Microsoft training courses.

Excel tip:

Enter formulae into multiple cells

If a formula is to be used in a series of cells, select the cells first. Now type in your formula and hold the Ctrl key while you press Enter. This enters the formula in each selected cell.

Just be careful with your absolute and relative cell references.

View all Excel hints and tips


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

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

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training