View Full Version : Solved: Deleting Rows
Nosstech
08-08-2008, 11:54 AM
I am trying to parse out a team sport schedule to different tabs. Thus far, I have copied Sheet1 ("Season") to Sheets 2&3 ("Home" & "Away").
On the Home tab, I want to delete all the "at" rows (column e).
On the Away tab, I want to delete all the "vs" rows (Column e).
Thanks for the help.
Bob Phillips
08-08-2008, 12:40 PM
Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim rng As Range
Dim rngCopy As Range
With ActiveSheet
LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
Set rng = .Range("E1").Resize(LastRow)
rng.AutoFilter field:=1, Criteria1:="at"
Set rngCopy = rng.SpecialCells(xlCellTypeVisible)
If Not rngCopy Is Nothing Then
rngCopy.EntireRow.Copy Worksheets("Home").Range("A1")
End If
rng.AutoFilter field:=1, Criteria1:="vs"
Set rngCopy = rng.SpecialCells(xlCellTypeVisible)
If Not rngCopy Is Nothing Then
rngCopy.EntireRow.Copy Worksheets("Away").Range("A1")
End If
End With
End Sub
Nosstech
08-11-2008, 09:57 AM
Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim rng As Range
Dim rngCopy As Range
With ActiveSheet
LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
Set rng = .Range("E1").Resize(LastRow)
rng.AutoFilter field:=1, Criteria1:="at"
Set rngCopy = rng.SpecialCells(xlCellTypeVisible)
If Not rngCopy Is Nothing Then
rngCopy.EntireRow.Copy Worksheets("Home").Range("A1")
End If
rng.AutoFilter field:=1, Criteria1:="vs"
Set rngCopy = rng.SpecialCells(xlCellTypeVisible)
If Not rngCopy Is Nothing Then
rngCopy.EntireRow.Copy Worksheets("Away").Range("A1")
End If
End With
End Sub
Thanks!!! As always, top notch help
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.