Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba courses london - counters excel

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Counters in excel

vba courses london - Counters in excel

ResolvedVersion Standard

Ricci has attended:
Excel VBA Intro Intermediate course

Counters in excel

I have some data that I'm trying to produce a report from, I have a huge list of employee names that are duplicated and are in no order. I want 1 list of employees in alphabetical order with no repitions to use in a drop down list on a form. I remembered in my training the mention of counters, but I can't remember how to use them or how to incorporate this with a form.

Cheers,
Ricci

RE: Counters in excel

To create a list if employees with no duplicates do the following:

Record a macro to Select the Name column and sort it

Create a sheet for the new records "New Sheet"

Create a OldRow counter and set it to the first row of the names

Create a NewRow counter and set it to the row of the "New Sheet" where the records are going

On the Daata Sheet if the Names aree in Column 1 do the following:

Do a For counter loop taking into account the number of rows in the data

Cells(OldRow,1).Select

Copy it to the new sheet

Move New row down One

Add the value of the cell to a variable

move OldRow down one

Check if the value of Cell(OldRow,1) equals the Variable

If it does Move down One row

Else

repeat the copy routine and add the new name to the variable

With the above routine in mind You can look at the code On the disk in the manual and adapt the code in CopySalesRecords and the little routione to check for duplicate dates





 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

VBA tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.