'What you need is a two dimensional array to store the previous values.
'I haven't tested it, but you could try something like this.
Dim D(1000,1000) 'Two dimensional data array
For each s In Worksheets
n = n + 1
For each c in range("B11:B60")
m = m + 1
D(n,m) = c.value
Next c
Next s
'Then you can iterrogate D for the cell in question
For y = 1 to 100
If cells(y,2) = "D" then
If D(n-1,y) ="D" And D(n-2,y) = "D" then
Cells(y,2).interior.colorindex = 3
End if
End if
Next y
You may want to run a macro to list the sheets first, i.e. cells(n,1) = s.name as they may be stored in a different order than they appear in the workbook.
Bookmarks