I have a spreadsheet where I need to calculate the number of times something has been done to a particular area, I know that when certain criteria exists a field in another spreadsheet should be incremented.
for i to rows.length
if Cell(A,i) == Cell(A,i+1) AND Cell(D,i) != Cell(D,i+1)
otherspreadsheet.field++
else if Cell(A,i) != Cell(A,i+1)
otherspreadsheet.field++
I don't know how to use vba with Microsoft excel, any help would be greatly appreciated.
+++
I was playing about with the code you provided me to get familiar and eventually figure this problem. The strYear doesn't seem to work, strYear = InputBox("enter year")
. If I enter 2014, the count comes out as 0. However if I replace the code below from "strYear" to 2014
then it works.
With MySheet
For i = 4 To LastRow
If .Cells(i, "AA").Value = "strYear" Then
GreensFCounter = GreensFCounter + 1
Else
GreensFCounter = GreensFCounter
End If
Next i
End With
MsgBox (GreensFCounter)