Hi guys
This is my first post - I hope it goes in correctly...
I need help to alter data in my spreadsheet but I have no VBA knowledge and I can't find anyone at my employment to help. I hope someone here can assist.
I would like a macro to check cells in Column "A" to detect the first 8 characters of text as "employee". In some cases the text is EmployeeID or EmployeeNumber, so I need to detect the first 8 characters.
When a match of the first 8 characters is found insert copy of Row 1 below each instance of the detected text.
(Actually Row 1 is an empty row except for the data in cell A1. So inserting a blank row and then copying the data from cell A1 into the first cell of the new Row will work too)
I was trying to alter these snippets of code but I'm lost...
The Data Begins in Row 5 of Column A
(first snippet)
Sub InsertRow_At_Employee()
For i = Range("A65536").End(xlUp).Row To 5 Step -1
If Left(Cells(i, 1).Value, 8) = "employee" Then Rows(i + 1).Insert
Next
End Sub
(second snippet)
If Left(Cells(i, 1).Value, 8) = "employee" Then
Cells(A, 1).Copy Destination:=Cells(i+1, 1)
End If
I hope you guys can help -
Thanks,
Larry
Moderator's Edit: Use code tags when posting code. To do so in future, select your code and click on the # icon at the top of your ost window.
Bookmarks