Hi all
I'm struggling a bit with a Run-time error '6' Overflow.
My code is only able to handle 32.767 cells so I assume the reason is a default Dim As Integer. If so I guees I only need to have Dim changed to Long but for some reason I can figure out how to do this in my For Each loop. And as the macro works fine besides this limitation it would be nice if there is an easy way to do add a Dim As Long.
This is relevant part of my code:
Dim myMonthRng As Range
Cells.Find(What:="Antal Måneder", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0).Select
Set myMonthRng = Range(ActiveCell, Selection.End(xlDown))
For Each cell In myMonthRng
If cell.Value >= 2 Then
cell.EntireRow.Interior.ColorIndex = 4
Else
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
For Each cell In myMonthRng
If cell.Value >= "Ny Sag" Then
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
Hopefully one of you will know a simple way
?
Thanks,
Martin
I'm struggling a bit with a Run-time error '6' Overflow.
My code is only able to handle 32.767 cells so I assume the reason is a default Dim As Integer. If so I guees I only need to have Dim changed to Long but for some reason I can figure out how to do this in my For Each loop. And as the macro works fine besides this limitation it would be nice if there is an easy way to do add a Dim As Long.
This is relevant part of my code:
Dim myMonthRng As Range
Cells.Find(What:="Antal Måneder", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0).Select
Set myMonthRng = Range(ActiveCell, Selection.End(xlDown))
For Each cell In myMonthRng
If cell.Value >= 2 Then
cell.EntireRow.Interior.ColorIndex = 4
Else
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
For Each cell In myMonthRng
If cell.Value >= "Ny Sag" Then
cell.EntireRow.Interior.ColorIndex = xlNone
End If
Next
Hopefully one of you will know a simple way

Thanks,
Martin