I've got a macro that delete values in a dataset that are higher than a value in a specific cell. This works fine
I then copied the macro, pasted it into a new macro template to reverse the sign so that it delete all values lower than a value in a specific cell and it just will not work. This is driving me crazy, can someone please help. Thanks
Sub MaxValue()
'
' MaxValue Macro
' This macro deletes all values greater than the value in Cell M1.
'
'
Dim cell As Range
For Each cell In Range("D11:I1000")
If cell.Value > ActiveSheet.Range("M1") Then
cell.ClearContents
End If
Next cell
End Sub
Sub MinValue()
'
' MinValue Macro
'This macro deletes all values lower than the value in Cell M2.
'
'
Dim cell As Range
For Each cell In Range("D11:I1000")
If cell.Value < ActiveSheet.Range("M2") Then
cell.ClearContents
End If
Next cell
End Sub
I then copied the macro, pasted it into a new macro template to reverse the sign so that it delete all values lower than a value in a specific cell and it just will not work. This is driving me crazy, can someone please help. Thanks
Sub MaxValue()
'
' MaxValue Macro
' This macro deletes all values greater than the value in Cell M1.
'
'
Dim cell As Range
For Each cell In Range("D11:I1000")
If cell.Value > ActiveSheet.Range("M1") Then
cell.ClearContents
End If
Next cell
End Sub
Sub MinValue()
'
' MinValue Macro
'This macro deletes all values lower than the value in Cell M2.
'
'
Dim cell As Range
For Each cell In Range("D11:I1000")
If cell.Value < ActiveSheet.Range("M2") Then
cell.ClearContents
End If
Next cell
End Sub