MarcoPolo82
12-20-2017, 01:22 AM
Hallo guys,
I registerd here because I have a very simple problem, I just want to get a counter running but I am getting just an error-13 message.
My code looks like this
Sub testcounter()
Dim cell As Range
Dim a As Integer
For Each cell In Worksheets("Sheet2").Range("D1:D3500")
If cell.Value = "1" Then
a = a + 1
End If
Next
MsgBox a
End Sub
It is a simplified version of a more complicated code i wrote, but they give out the same error, every time where the If starts.
The code is based on other posts on the web and looks pretty straight forward but it does not work even in the simplest of versions like above.
Does anybody have a clue ?
I registerd here because I have a very simple problem, I just want to get a counter running but I am getting just an error-13 message.
My code looks like this
Sub testcounter()
Dim cell As Range
Dim a As Integer
For Each cell In Worksheets("Sheet2").Range("D1:D3500")
If cell.Value = "1" Then
a = a + 1
End If
Next
MsgBox a
End Sub
It is a simplified version of a more complicated code i wrote, but they give out the same error, every time where the If starts.
The code is based on other posts on the web and looks pretty straight forward but it does not work even in the simplest of versions like above.
Does anybody have a clue ?