butters149
New Member
- Joined
- Mar 21, 2018
- Messages
- 23
Hello,
I am having some trouble writing up a code on how to find a specific text in column A, then once found it will add a row above it. The problem is that there can be more than one of the same text in that column so I would probably need to loop it too.
Application.ScreenUpdating = False
Dim m As Long
Dim Lastrow2 As Long
Lastrow2 = Cells(Rows.Count, "A").End(xlUp).Row
For m = 1 To Lastrow2
If Cells(m, "A").Value = "sample text" Then Cells(m, "A").Offset(-1, 0).EntireRow.Insert
Next
Application.ScreenUpdating = True
I am having some trouble writing up a code on how to find a specific text in column A, then once found it will add a row above it. The problem is that there can be more than one of the same text in that column so I would probably need to loop it too.
Application.ScreenUpdating = False
Dim m As Long
Dim Lastrow2 As Long
Lastrow2 = Cells(Rows.Count, "A").End(xlUp).Row
For m = 1 To Lastrow2
If Cells(m, "A").Value = "sample text" Then Cells(m, "A").Offset(-1, 0).EntireRow.Insert
Next
Application.ScreenUpdating = True