I am trying to copy all the 3 rows which contains cells with "red" and similar with blue when the user gives the Input in the userform.
What I required is, when the user gives "red" and want to replace red with "green" and "click on commandbutton", the new rows should be created by copying the rows contatining red and replace red with green.
Userform:
TextBox to search : red
Sub Add()
sheet_name = "Sheet1"
column_name = "C"
For r = 1 To Sheets(sheet_name).Range(column_name & Rows.Count).End(xlUp).row
    If Trim(Sheets(sheet_name).Cells(r, column_name).Value) = team_name Then
        Sheets(sheet_name).Rows(r).EntireRow.Select
        Selection.Copy
        ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
        Selection.Insert Shift:=xlDown
        Selection.Replace What:=team_name, Replacement:=emp_name, LookAt:=xlPart, _
                    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                    ReplaceFormat:=False
    End If
Next
column_name = "E"
For r = 1 To Sheets(sheet_name).Range(column_name & Rows.Count).End(xlUp).row
    If Trim(Sheets(sheet_name).Cells(r, column_name).Value) = team_name Then
        Sheets(sheet_name).Rows(r).EntireRow.Select
        Selection.Copy
        ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
        Selection.Insert Shift:=xlDown
        Selection.Replace What:=team_name, Replacement:=emp_name, LookAt:=xlPart, _
                    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                    ReplaceFormat:=False
    End If
Next
End subTextBox to replace : green The Excel sheet Looks like below:


 
    