98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Counters in excel
vba courses london - Counters in excel
Resolved · Low Priority · Version 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 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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
VBA tip:Use GoTo to Select A Cell With VBATo select a certain cell on a Worksheet you can use: |