Hi am a basic learner in using VB. I created the following code using record macro. It does the job. However, it is giving error. Hence, I request you to take a look.
While (Cells.Find(What:="Data", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate And ActiveCell.Row <= ActiveSheet.UsedRange.Rows.Count)
Application.ScreenUpdating = True
Fnd = ActiveCell.Row
Frm = Fnd - 2
Too = Fnd + 5
Rows(Frm & ":" & Too).Select
Selection.Delete Shift:=xlUp
Cells(Frm, 1).Select
Wend
Appreciate your response. Thanks!
While (Cells.Find(What:="Data", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate And ActiveCell.Row <= ActiveSheet.UsedRange.Rows.Count)
Application.ScreenUpdating = True
Fnd = ActiveCell.Row
Frm = Fnd - 2
Too = Fnd + 5
Rows(Frm & ":" & Too).Select
Selection.Delete Shift:=xlUp
Cells(Frm, 1).Select
Wend
Appreciate your response. Thanks!