I have this code that will look for a match of a value in a specific cell in column G and copy that row to another worksheet. It was working fine (except that I want to restrict the copied cells to a set number of rows rather than the entire row, but that is a different issue, and not very important at this point), but I suddenly started getting a window popping up every time I ran the code: "The name 'COSTCODES' already exists. Click Yes to use that version of the name, or click No to rename the version of 'COSTCODES' you're moving or copying." I have to click Yes for every row that the code copies over. For now, this only requires 5 clicks, but I am only testing it on a small portion of the final file and I don't want to have to click 1000 times just to step through the program.
Here is the code I am using:
If anyone can help, I would appreciate it.
Thanks in advance.
Here is the code I am using:
Sub CopyxSM() Dim RngColF As Range
Dim i As Range
Dim Dest As Range
Set Dest = Sheets("SOLAR MATERIALS - SM").Range("A7")
With Sheets("MASTER PO LOG")
.Select
Set RngColF = .Range("G1", .Range("G" & .Rows.Count).End(xlUp))
For Each i In RngColF
Select Case i.Value
Case "SM-01", "SM-02", "SM-03", "SM-04", "SM-05"
i.EntireRow.Copy Dest
Set Dest = Dest.Offset(1)
Case Else
'do nothing
End Select
Next i
End With
End Sub
If anyone can help, I would appreciate it.
Thanks in advance.