I am trying to create a macro to format my stock sheets. I need to only show values up to 8 and then show 9+ for any value over that. I also need to get rid of any 0's or negative numbers.
I need to run this loop 4 times on columns C, D, E and F and the file is about 15,000 lines long. The code works when I debug it, but it crashes the application if it just runs through. I know I can't loop through that much, but is there another way that I can do it?
Call SetStockLevels(range("C3:C" & lastRow))
Private Sub SetStockLevels(range As range)
For Each c In range
If c.Value < 1 Then
c.ClearContents
ElseIf c.Value > 8 Then
c.Value = "9+"
End If
Next
End Sub
I already have these funtions that I call at the start and the end of the macro respectively.
Public Sub speedup()
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
End Sub
Public Sub normal()
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub