I have a very simple code I'm trying to run, here:
Sub Highlight()
Dim Diff As Range, cell As Range
Set Diff = Sheets(1).UsedRange.Columns("N:S")
For Each cell In Diff
If cells.Value2 > 0.1 Then
cell.Interior.ColorIndex = 0
End If
Next
End Sub
However, right at the If statement, I get runtime 7: Out of Memory. I'm running this on a fairly small data set (<5,000 cells), and have closed all other programs/ unnecessary processes, and task manager shows plenty of memory. I have no idea what could be causing this at this point.
Any ideas?
cells.Value2instead ofcellthat you're using in thefor each- you don't have a variable namedcellsdeclared anywhere) or you've got erroneous data in one or more cells.