NextWorldAngel
New Member
- Joined
- Oct 19, 2006
- Messages
- 31
I'm using the below code, but I need to edit it where I can delete The cells of the row with XXXX in a specific column from column A:AW. I have some data in other columns that I need to not delete.
So basically if I2 = "XXXX" then delete A2:AW2 and shift up.
Sub Update3()
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
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
For Lrow = Lastrow To Firstrow Step -1
With .Cells(Lrow, "I")
If Not IsError(.Value) Then
If Not IsError(Application.Match(.Value, _
Array("XXXX"), 0)) Then .Row.Delete
End If
End With
Next Lrow
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub
End Sub
So basically if I2 = "XXXX" then delete A2:AW2 and shift up.
Sub Update3()
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
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
For Lrow = Lastrow To Firstrow Step -1
With .Cells(Lrow, "I")
If Not IsError(.Value) Then
If Not IsError(Application.Match(.Value, _
Array("XXXX"), 0)) Then .Row.Delete
End If
End With
Next Lrow
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub
End Sub