I have a report that comes to me dumped into column A of Excel, and each month the report varies from 300 to 80000 rows. What I want to do is to find each cell in column “A” that contains the word “apple” or “oranges” or “banana” or Grapefruit”. Once all the occurrences have been found I want them to be pasted into worksheet2. So far the best that I can do is to find all the occurrences and have them either pasted in their own worksheet or a separate column on workseet2. This is what I have come up with thus far. Any assistance would greatly be appreciated.. The example that I have here doesn’t paste the found information into the next empty row.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
> </o
>
Sub apples()
<o
> </o
>
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
> </o
>
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*apples*" Then
sCount = sCount + 1
dRow = dRow + 1
'copy cols A,F,E & D
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
> </o
>
End If
Next sRow
MsgBox sCount & "Significant rows copied", vbInformation, "Transfer Done"
<o
> </o
>
End Sub
Sub banana ()
<o
> </o
>
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
> </o
>
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "* banana *" Then
sCount = sCount + 1
dRow = dRow + 1
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
> </o
>
End If
Next sRow
MsgBox sCount & "Significant rows copied", vbInformation, "Transfer Done"
<o
> </o
>
End Sub
<o
> </o
>
Sub oranges()
<o
> </o
>
<o
> </o
>
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
> </o
>
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*oranges*" Then
sCount = sCount + 1
dRow = dRow + 1
'copy cols A,F,E & D
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
> </o
>
End If
Next sRow
MsgBox sCount & " Significant rows copied", vbInformation, "Transfer Done"
<o
> </o
>
End Sub
Sub grapefruit()
<o
> </o
>
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
> </o
>
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*grapefruit*" Then
sCount = sCount + 1
dRow = dRow + 1
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
> </o
>
End If
Next sRow
MsgBox sCount & " Significant rows copied", vbInformation, "Transfer Done"
<o
> </o
>
End Sub
<o
> </o
>
End Sub
Sub Runall()
Call apple
Call orange
Call grapefruit
Call banana
End Sub
<o
> </o
>
<o
> </o
>
<o
> </o
>
<o
> </o
>
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
Sub apples()
<o
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*apples*" Then
sCount = sCount + 1
dRow = dRow + 1
'copy cols A,F,E & D
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
End If
Next sRow
MsgBox sCount & "Significant rows copied", vbInformation, "Transfer Done"
<o
End Sub
Sub banana ()
<o
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "* banana *" Then
sCount = sCount + 1
dRow = dRow + 1
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
End If
Next sRow
MsgBox sCount & "Significant rows copied", vbInformation, "Transfer Done"
<o
End Sub
<o
Sub oranges()
<o
<o
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*oranges*" Then
sCount = sCount + 1
dRow = dRow + 1
'copy cols A,F,E & D
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
End If
Next sRow
MsgBox sCount & " Significant rows copied", vbInformation, "Transfer Done"
<o
End Sub
Sub grapefruit()
<o
With Sheets("Sheet1").Select
End With
Dim DestSheet As Worksheet
Set DestSheet = Worksheets("Sheet2")
Dim sRow As Long 'row index on source worksheet
Dim dRow As Long 'row index on destination worksheet
Dim sCount As Long
sCount = 0
dRow = 1
<o
For sRow = 1 To Range(" A65536").End(xlUp).Row
If Cells(sRow, "A") Like "*grapefruit*" Then
sCount = sCount + 1
dRow = dRow + 1
Cells(sRow, "A").Copy Destination:=DestSheet.Cells(dRow, "A")
<o
End If
Next sRow
MsgBox sCount & " Significant rows copied", vbInformation, "Transfer Done"
<o
End Sub
<o
End Sub
Sub Runall()
Call apple
Call orange
Call grapefruit
Call banana
End Sub
<o
<o
<o
<o