D
DoooWhat
I want to clear the contents of certain cells if other data on the
same line meets my criteria. For instance, if cell V8=1, I want to
clear the contents (not delete) of cell M8.
I have some code that gets close, but doesn't quite get me what I
want. I have tried to tinker with it, but to no avail.
------------------------------------------------------------------
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
Firstrow = ActiveSheet.UsedRange.Cells(8).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "V").Value) Then
ElseIf .Cells(Lrow, "V").Value = "1"
Then .Rows(Lrow).Delete
'''''''''''''''''' .Rows(Lrow).Delete should be replaced
with something that
tells it to clear contents of the cell in column
M that corresponds
to a value of 1 in column V
End If
Next
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
same line meets my criteria. For instance, if cell V8=1, I want to
clear the contents (not delete) of cell M8.
I have some code that gets close, but doesn't quite get me what I
want. I have tried to tinker with it, but to no avail.
------------------------------------------------------------------
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
Firstrow = ActiveSheet.UsedRange.Cells(8).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "V").Value) Then
ElseIf .Cells(Lrow, "V").Value = "1"
Then .Rows(Lrow).Delete
'''''''''''''''''' .Rows(Lrow).Delete should be replaced
with something that
tells it to clear contents of the cell in column
M that corresponds
to a value of 1 in column V
End If
Next
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With