Conditional Search Copy Entire Row to next row on match
First time VBA user using Excel 2010 part of Office Pro 2010.
I need to search for data in col 2 and if it matches then copy that row to row below.
Search terms are "A" OR "D"
Before
Num Reg Com 1 Com 2
2 a yes no
3 b no no
4 d yes yes
5 c no no
After
Num Reg Com 1 Com 2
2 A yes no
2 A yes no
3 B no no
4 D yes yes
4 D yes yes
5 C no no
Don't really have good idea how to do this.
Have found these commands, but don't know if it will work.
Cells.Find(What:="A", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Copy
ActiveCell.EntireRow.Insert
Thanks
One solution
B is col searched
Sub COPY_CURRENT_ROW_CASE()
Application.ScreenUpdating = False
For MY_ROWS = (ActiveSheet.UsedRange.Rows.Count + 1) To 1 Step -1
x = Range("B" & MY_ROWS).Value
Select Case x
Case "A", "D"
Rows(MY_ROWS).Copy
Rows(MY_ROWS + 1).Insert
Case Else
End Select
Next MY_ROWS
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub