I'm attempting to copy all cells within a sheet in excel that contain specific text and then paste the copied text into a new sheet. However, I have no VBA knowledge and have so far attempted to use other posts here to accomplish my goal with no luck. It would be awesome if the macro asked what text I was looking for but if it cannot that is fine too, I wont be picky.
My issue I have is that I'm looking for a cell that contains "Photoeye": (including the " "). I have an unknown length of A-rows to search through as well, sometimes is several thousand rows, other times it is around 500.
The VBA code I am currently using is as follows, again I didnt make that code as it is from another post but I cannot seem to get it to work when looking for "Photoeye":
My issue I have is that I'm looking for a cell that contains "Photoeye": (including the " "). I have an unknown length of A-rows to search through as well, sometimes is several thousand rows, other times it is around 500.
The VBA code I am currently using is as follows, again I didnt make that code as it is from another post but I cannot seem to get it to work when looking for "Photoeye":
VBA Code:
Sub PHOTOEYE_1()
Dim c As Range
Dim Source As Worksheet
Dim Target As Worksheet
Dim Target1 As Worksheet
Set Source = ActiveWorkbook.Worksheets("Sheet1")
For Each c In Source.Range("A1:A99999" & Source.Cells(Rows.Count, 1).End(xlUp).Row)
If c = ""Photoeye:"" Then
c.EntireRow.Copy
Target.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
ElseIf c = "Outros" Then
c.EntireRow.Copy
Target1.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next c
End Sub