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