R
RigasMinho
I have this code here where it finds and copies the entire row where
the search is made.
But instead of copying the entire row is there a way to cut the
information instead?
Let me know thanks
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("E:F")
Set rngFound = rngToSearch.Find(What:="AC", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
'rngFoundAll.Copy rngDestination
'rngDestination.Resize(rngFoundAll.Cells.Count).Interior.ColorIndex = 3
rngFoundAll.EntireRow.Copy rngDestination
End If
the search is made.
But instead of copying the entire row is there a way to cut the
information instead?
Let me know thanks
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("E:F")
Set rngFound = rngToSearch.Find(What:="AC", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
'rngFoundAll.Copy rngDestination
'rngDestination.Resize(rngFoundAll.Cells.Count).Interior.ColorIndex = 3
rngFoundAll.EntireRow.Copy rngDestination
End If