I am trying to cycle through rows in column 4 to find a manually inserted person in that column. Once the name is found, i would like to add a row below that, and then i would like the function to stop there. Names will be listed more than once and i dont want it to add a row every time it finds the name, just the first time. the names start on row 5
I also want it to alert me with a message box if the inputed name is not listed
anything in red is what i know is wrong
please help me out
Sub addequipment()
Dim ws As Worksheet
Dim foremancol As String
Dim foreman As String, i As Long, count As Long
Set ws = ActiveSheet
foreman = Application.InputBox("Which Foreman is adding a Piece of Equipment")
For i = 0 To end
foremancol = ws.Cells(5 + i, 4)
If foremancol = foreman Then
'insert a row below
ActiveCell.Offset(1).EntireRow.Insert
End If
Next i
End Sub
I also want it to alert me with a message box if the inputed name is not listed
anything in red is what i know is wrong
please help me out
Sub addequipment()
Dim ws As Worksheet
Dim foremancol As String
Dim foreman As String, i As Long, count As Long
Set ws = ActiveSheet
foreman = Application.InputBox("Which Foreman is adding a Piece of Equipment")
For i = 0 To end
foremancol = ws.Cells(5 + i, 4)
If foremancol = foreman Then
'insert a row below
ActiveCell.Offset(1).EntireRow.Insert
End If
Next i
End Sub