Good day to you all.
As the title implies, I would like to copy entire row and paste it at the SAME WORKSHEET below the cell that contain specific word. For example,
<tbody>
</tbody>
I would like to change the above table to :
<tbody>
</tbody>
The specific text i meant was this symbol "/". So if column B contains 2 "/", then 2 additional row will be added below the original row.
I have a macro that could possibly do this but end up giving me an error. I would really appreciate if someone could point out where is the error.
Thank you!
As the title implies, I would like to copy entire row and paste it at the SAME WORKSHEET below the cell that contain specific word. For example,
A | B | C |
XXXXXX | ABCDEFG/123456 | YYYYY |
<tbody>
</tbody>
I would like to change the above table to :
A | B | C |
XXXXXX | ABCDEFG/123456 | YYYYY |
XXXXXX | ABCDEFG/123456 | YYYYY |
<tbody>
</tbody>
The specific text i meant was this symbol "/". So if column B contains 2 "/", then 2 additional row will be added below the original row.
I have a macro that could possibly do this but end up giving me an error. I would really appreciate if someone could point out where is the error.
Code:
Sub Insert_CopyPaste()
Dim LastRow As Long, I As Long, txt As String
txt = "/" 'set text to search
With Sheets("Sheet9")
LastRow = .Range("B6000").End(xlUp).Row
Do While I <= LastRow
If .Range("C" & I).Value = "/" Then
.Range("a" & I).EntireRow.Copy
.Range("a" & I + 1).EntireRow.Insert
.Range("a" & I + 1).PasteSpecial xlPasteValues
End If
I = I + 1 'goto next row to check
Loop
End With
End Sub
Thank you!