J
John
I realize the following maybe a bit repatitve, but my main concern is that I
run the code and it works for finding "SA", but not "NI" or "DN". Any help
is appreciated.
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Sheets("t0983101").Select
Application.CutCopyMode = False
Range("A4").Select
Dim rngToSearch As Range
Dim wks As Worksheet
Dim rngFound As Range
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="SA", LookIn:=xlValues,
lookat:=xlWhole)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("SA").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
Sheets("t0983101").Select
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="ni", LookIn:=xlValues)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("ni").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="DN", LookIn:=xlValues)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("DN").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
end sub
run the code and it works for finding "SA", but not "NI" or "DN". Any help
is appreciated.
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Sheets("t0983101").Select
Application.CutCopyMode = False
Range("A4").Select
Dim rngToSearch As Range
Dim wks As Worksheet
Dim rngFound As Range
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="SA", LookIn:=xlValues,
lookat:=xlWhole)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("SA").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
Sheets("t0983101").Select
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="ni", LookIn:=xlValues)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("ni").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
Set wks = Sheets("t0983101")
Set rngToSearch = wks.Columns(5)
Set rngFound = rngToSearch.Find(what:="DN", LookIn:=xlValues)
If rngFound Is Nothing Then
Sheets("Macro Sheet").Select
End
Else
Do
rngFound.EntireRow.Cut
Sheets("DN").Select
Range("A9").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("t0983101").Select
Set rngFound = rngToSearch.FindNext
Loop Until rngFound Is Nothing
End If
end sub