Can anyone spot an error with this?Code:Sub Month() Sheets("Sheet2").Select Range("J2:J13").Select 'setting the cells interested in Months = Range("B2:B12421") Years = Range("C2:C12421") If Years = 1971 And Months = 1 Then 'setting the equation total = 0 r = 2 Do total = total + Cells(r, 10) / 30 r = r + 1 Loop Until Cells(r, 7) = "End of data" End If End Sub
The data is from a spreadsheet which records daily water measurements over a period of 11 years, the task is to design a macro to calculate a mean value for each year, month and week.
line 9 is where a type mismatch error occurs.
Cheers


LinkBack URL
About LinkBacks
Reply With Quote
