maryam
04-26-2007, 08:13 AM
I am trying the following code under sheet_activate event but it gives error.
For i = 1 To 100
If Cells(12, i).Value <> "" And Cells(13, i).Value <> "" Then
Cells(14, i) = Cells(12, i).Value - 25 * Cells(13, i).Value
End If
Next
the error shows is application-defined or object-defined error. it seems the problem is with i at cells( , i) and we cannot have variable in paranteses. How to solve this problem and how to write other way?
For i = 1 To 100
If Cells(12, i).Value <> "" And Cells(13, i).Value <> "" Then
Cells(14, i) = Cells(12, i).Value - 25 * Cells(13, i).Value
End If
Next
the error shows is application-defined or object-defined error. it seems the problem is with i at cells( , i) and we cannot have variable in paranteses. How to solve this problem and how to write other way?