Hi
I'm working on a macro in which I want it to delete every row in which the value of the cell in column A matches the value of fixed cell "I1".
Partially my code works, however it doesn't take every cell in the range in to account. It skips every other row.
Can anyone of you guys pls help me out with this one?
Greetz,
Tino
Code used:
Sub TESTING()
Dim myCel As Range
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A2") = "=RIGHT(B2,3)"
Range("A2").Select
Selection.Copy
Range("A2:A23").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
Application.CutCopyMode = False
Range("H1") = "=TODAY()"
Range("I1") = "=""W"" & INT(((RC[-1]-DATE(YEAR(RC[-1]-WEEKDAY(RC[-1]-1)+4),1,3)+WEEKDAY(DATE(YEAR(RC[-1]-WEEKDAY(RC[-1]-1)+4),1,3))+5)/7)-21)"
Range("I1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
Application.CutCopyMode = False
For Each myCel In Range("A:A")
If myCel.Value = Range("$I$1").Value Then
myCel.Select
Selection.EntireRow.Delete
End If
Next myCel
End Sub
Bookmarks