dear all,
I am trying to compute an average of certain range (which depends on user input) in every worksheet of the workbook.
i succeed only in one sheet ("sheet2") and cant make the computation in the other sheets.
please see the code:
Dim s As Worksheet
For Each s In Worksheets
For m = 1 To 28 '#loop on the row m
totold = 0
tot = 0
For j = column_min To column_max '#loop on the column j - column_min and column_max are integers
tot = totold + Cells(m, j).Value
totold = tot
Next j
Cells(m, 17).Value = totold / (column_max - column_min + 1)
Next m '#next row
Next s '#next sheet
i have tried to use the "with worksheets ()...end with" but have no success.
thanks in advance,
Yohai
Bookmarks