Hi - I'm a novice user running into a problem I've spent a few days trying to correct. I'm using the following code to run through a worksheet and if the there is data in a cell in column O I need to clear contents of the corresponding cell in column H but I keep getting a compile error... the problem seems to be with the "For deleterate" statement. Any suggestions? Thanks in advance
Sub deleterate()
' disable excel fetures
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.ScreenUpdating = False
'variables
Dim deleterate As Long
Dim ws As Worksheet
' set object
Set ws = Sheets("Import file")
' loop through the data to find the $$ amounts in column o
For deleterate = ws.Range("O" & Rows.count).End(xlUp).Row
' indentify values in O which have value
If ws.Range("O" & deleterate).Value <> 0 Then
ws.Cells(deleterate, 8).ClearContents
End If
' move to next cell in the range
Next deleterate
' enable excel features
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Sub deleterate()
' disable excel fetures
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.ScreenUpdating = False
'variables
Dim deleterate As Long
Dim ws As Worksheet
' set object
Set ws = Sheets("Import file")
' loop through the data to find the $$ amounts in column o
For deleterate = ws.Range("O" & Rows.count).End(xlUp).Row
' indentify values in O which have value
If ws.Range("O" & deleterate).Value <> 0 Then
ws.Cells(deleterate, 8).ClearContents
End If
' move to next cell in the range
Next deleterate
' enable excel features
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub