Hey peeps,
I'm trying to use this vba on my sheet but I want to clear only the cells without a formula.
This is the code that i'm using.
The objective is when cel C is valued "IN", it would clear all entry in the range D through J that doesn't contain formulas.
If there is a simpler way in doing this, please don't hasitate to tell me.
Thanks in advance for the help.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myLastRow As Long
Dim i As Long
Application.ScreenUpdating = False
' Find last row
myLastRow = Cells(Rows.Count, "C").End(xlUp).Row
' Loop through range
For i = 6 To myLastRow
If Cells(i, "C").Value = "IN" Then Range(Cells(i, "D"), Cells(i, "J")).ClearContents
Next i
Application.ScreenUpdating = True
I'm trying to use this vba on my sheet but I want to clear only the cells without a formula.
This is the code that i'm using.
The objective is when cel C is valued "IN", it would clear all entry in the range D through J that doesn't contain formulas.
If there is a simpler way in doing this, please don't hasitate to tell me.
Thanks in advance for the help.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myLastRow As Long
Dim i As Long
Application.ScreenUpdating = False
' Find last row
myLastRow = Cells(Rows.Count, "C").End(xlUp).Row
' Loop through range
For i = 6 To myLastRow
If Cells(i, "C").Value = "IN" Then Range(Cells(i, "D"), Cells(i, "J")).ClearContents
Next i
Application.ScreenUpdating = True