Date problem

J

Jamie

Hi all,

Im having a weird problem with the code im using. The code is as follows

For ArrayRow = 0 To VarCount
SalesCount = 0
UserRow = varData(ArrayRow)
For NowRow = 2 To LastRow
SheetDate = Cells(NowRow, 3).Value
If FirstDate <= SheetDate And LastDate >= SheetDate Then

If UserRow = Cells(NowRow, 4).Value Then
SalesCount = SalesCount + 1
End If
If Row = LastRow Then
Sheets("SalePerson").Cells(CurrentSheetRow, 1).Value = UserRow
Sheets("SalePerson").Cells(CurrentSheetRow, 2).Value =
SalesCount
CurrentSheetRow = CurrentSheetRow + 1
End If
End If
Next NowRow
Next ArrayRow

Now the idea of this code is to index through a list of sales and if each
member of the team if the row in question is between the start date and the
finnish date and the user in question it will add one to SalesCount. Then on
the last run for each user it will add the information to the SalePerson
sheet.

An example of the data i use is:

OrderID CustomerID Date Sales Person
10000 1000 03/05/04 oadmin
10001 1000 03/05/04 oadmin
10003 1000 05/06/04 oadmin
10004 1000 05/07/04 Jammie
10005 1000 05/08/04 Bob
10006 1000 08/05/04 oadmin


If i run that data through the code it seems to skip the first two rows and
carries on from the third.

Thanks for any help in advance

Jamie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top