vba courses london - counters excel
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

vba courses london - Counters in excel

resolvedResolved · Low Priority · Version Standard

replyReply Wed 24 Jan 2007, 17:26Delegate Ricci said...

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

For upcoming training course dates see: Pricing & availability

replyReply Fri 26 Jan 2007, 11:00Trainer Carlos said...

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





 

Vba tip:

Use GoTo to Select A Cell With VBA

To select a certain cell on a Worksheet you can use:

Application.Goto Reference:=Range("V300")

or more simply

Range("V300").Select

If, on the other hand, you want the selected cell to be the top/left cell on the screen you use:

Application.Goto Reference:=Range("V300"), Scroll=True

View all VBA hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard