I am trying to take a bunch of data (each entry listed on seperate rows) and
trying to filter the data. What I am trying to do is to take some data, and
evaluate the data in column "G" of it. If the text in column G matches one of
several cases, I want to copy that ENTIRE for from the 1st spreadsheet to
another worksheet.
I want to take all the unique data entries that matches the case and have them
show up in a fresh spreadsheet.
I wrote the below code, and am having trouble actually getting it to work. Any
suggestions/help/advice?
Thanks,
Vinay
-------------------------------------------
Sub VinayMacro()
'
' Macro3 Macro
' Macro recorded 11/3/2006 by TEA
Dim currentError As String
Dim nstart As Integer
nstart = 2
Dim row2 As Integer
LastCellsWithData 'runs function below
n = nstart
row2 = 3
While n < LastRowWithData
Worksheets("ww0207").Activate
MsgBox Range(7, 3).Value
currentError = Range("G" & CStr(n)).Value '**********THIS IS WHERE I AM
HAVING ONE PROBLEM**********
If currentError = "Exh. pressure is abnormal (MS2)" Or "Vapor purge timeout"
Then
' Worksheets("ww0207").Activate
Rows(n).Select
'ActiveCell.Rows(n).EntireRow.Select
Selection.Copy
Worksheets("Sheet2").Activate
'Range(2, 1).Select
ActiveCell.Rows(row2).Select
row2 = row2 + 1
MsgBox "HellO"
'ActiveWindow.SmallScroll Down:=-21
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
ActiveSheet.Paste
Worksheets("ww0207").Activate
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Copy
Sheets("Sheet2").Select
ActiveWindow.SmallScroll Down:=-21
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
ActiveSheet.Paste
Else
n = n + 1
End If
Wend
'MsgBox "all done"
End Sub