help with loop
I need to process some data that looks like this:
02.01.01.01 PSE Staff
02.01.01.01 PSE Staff
02.01.01.01 PSE Staff
02.01.01.01 PSE Staff
02.03.01 Materials&Processes
02.03.01 Materials&Processes
02.03.02 Contamination Cntrl
02.03.02 Contamination Cntrl
02.07.02.01 Launch Sys Engrg
02.07.02.01 Launch Sys Engrg
02.08.01.01 Project Requirements
02.08.01.02 Project Requirements
There are more columns to the right that I need to summarize.
I need a loop (or maybe more than 1) to process each record and when
value in col A (task number) changes:
1. sum numeric cols from start of current "A" to end
2. delete duplicate labels after 1st row of current "A"
I'm sure this has been tackled before, so I hope someone can steer me
in the right direction. So far I have this:
Sub tester()
iRepRow = 2
sThisTask = Cells(iRepRow, 1)
sLastTask = sThisTask
Do
iThisTaskStartRow = iRepRow
Do
'get next
iRepRow = iRepRow + 1
sThisTask = Cells(iRepRow, 1)
'check for a new task
If sThisTask < sLastTask Then
'process this task here
Exit Do
End If
sLastTask = sThisTask
Loop
If iRepRow lMaxRow Then
Exit Do
End If
Loop
End Sub
|