Hi,
I am trying to find text in one spreadsheet ("PerformanceT2") in column ("E") and the copy cells from the row in which text was found from columns ("E") ("F") and ("V") from that spreadsheet ("PerformanceT2") and then copy these cells into different spreadsheet ("Cal.PerfT") and paste them in columns ("AB"), ("AC") and ("AD") respectively.
I tried to start with Cells.Find but in the end, I did not know how to stop the loop once find function cycled through all cells.
Here is macro I've been trying to run, feel free to point out mistakes
I appreciate any help
I am trying to find text in one spreadsheet ("PerformanceT2") in column ("E") and the copy cells from the row in which text was found from columns ("E") ("F") and ("V") from that spreadsheet ("PerformanceT2") and then copy these cells into different spreadsheet ("Cal.PerfT") and paste them in columns ("AB"), ("AC") and ("AD") respectively.
I tried to start with Cells.Find but in the end, I did not know how to stop the loop once find function cycled through all cells.
Here is macro I've been trying to run, feel free to point out mistakes
VBA Code:
Sub Search_loop()
Dim FoundCellAdress As String
Dim i As Integer
Dim rng1, C1 As Range
FoundCellAdress = ActiveCell.Address
Set rng1 = Worksheets("Cal.PerfT").Range("AB2")
Set C1 = Worksheets("PerformanceT2").Range("E2")
For i = 0 To 10
Sheets("PerformanceT2").Select
Cells.Find(What:="Soleri3", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Copy
Sheets("Cal.PerfT").Select
rng1.Offset(2 * i, 0).PasteSpecial
Sheets("PerformanceT2").Select
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Copy
Sheets("Cal.PerfT").Select
rng1.Offset(2 * i + 1, 0).PasteSpecial
If ActiveCell = C1 Then
Exit Do
End If
Next i
Loop
MsgBox "End of search"
End Sub
I appreciate any help