how adapt ron de bro=in code to find based cell ?
Option Explicit
Sub Copy_To_Another_Sheet_1()
Dim FirstAddress As String
Dim MyArr As Variant
Dim rng As Range
Dim Rcount As Long
Dim I As Long
Dim NewSh As Worksheet
Dim InCellRng As Range
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Fill in the search Value
InCellRng = Worksheets("FindSht").Range("B4").Value 'Array("bat")
'You can also use more values in the Array
'myArr = Array("@", "www")
'Add new worksheet to your workbook to copy to
'You can also use a existing sheet like this
'Set NewSh = Sheets("Sheet2")
Set NewSh = Worksheets.Add
With Sheets("Cadastro de Itens").Range("C6:C1000")
Rcount = 0
For I = LBound(InCellRng) To UBound(InCellRng)
'If you use LookIn:=xlValues it will also work with a
'formula cell that evaluates to "@"
'Note : I use xlPart in this example and not xlWhole
Set rng = .Find(what:=InCellRng(I), _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
FirstAddress = rng.Address
Do
Rcount = Rcount + 1
rng.Copy NewSh.Range("A" & Rcount)
' Use this if you only want to copy the value
' NewSh.Range("A" & Rcount).Value = Rng.Value
Set rng = .FindNext(rng)
Loop While Not rng Is Nothing And rng.Address <> FirstAddress
End If
Next I
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Bookmarks