Hi Drscott21
Try this Code in the attached...CTRL + x will fire the Code.
Option Explicit
Sub Split_Service()
Dim ws As Worksheet
Dim ws1 As Worksheet
Dim LR As Long
Application.ScreenUpdating = False
Set ws = Sheets("Admission")
With ws
LR = .Range("D" & .Rows.Count).End(xlUp).Row
.Range("A1:O" & LR).AutoFilter Field:=4, Criteria1:= _
"=2-3 sicu", Operator:=xlOr, Criteria2:="=2-3 surg"
If .Columns(4).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
Set ws1 = Sheets("Surg Adm")
With ws1
.UsedRange.Offset(1, 0).ClearContents
End With
.Range(.Cells(2, 1), .Cells(LR, "O")).SpecialCells(xlCellTypeVisible).EntireRow.Copy
ws1.Range("A2").PasteSpecial (xlPasteColumnWidths)
ws1.Range("A2").PasteSpecial (xlPasteValues)
End If
.AutoFilterMode = False
.Range("A1:O" & LR).AutoFilter Field:=4, Criteria1:= _
Array("4-4 sarrtp", "8-1", "8-3", "ed psyc"), Operator:=xlFilterValues
If .Columns(4).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
Set ws1 = Sheets("Psy Adm")
With ws1
.UsedRange.Offset(1, 0).ClearContents
End With
.Range(.Cells(2, 1), .Cells(LR, "O")).SpecialCells(xlCellTypeVisible).EntireRow.Copy
ws1.Range("A2").PasteSpecial (xlPasteColumnWidths)
ws1.Range("A2").PasteSpecial (xlPasteValues)
End If
.AutoFilterMode = False
.Range("A1:O" & LR).AutoFilter Field:=4, Criteria1:= _
Array("2-3 med", "2-3 micu", "ed med"), Operator:=xlFilterValues
If .Columns(4).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
Set ws1 = Sheets("Med Adm")
With ws1
.UsedRange.Offset(1, 0).ClearContents
End With
.Range(.Cells(2, 1), .Cells(LR, "O")).SpecialCells(xlCellTypeVisible).EntireRow.Copy
ws1.Range("A2").PasteSpecial (xlPasteColumnWidths)
ws1.Range("A2").PasteSpecial (xlPasteValues)
End If
.AutoFilterMode = False
.Range("A1:O" & LR).AutoFilter Field:=4, Criteria1:= _
Array("N42-2C", "N42-1B", "43-1"), Operator:=xlFilterValues
If .Columns(4).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
Set ws1 = Sheets("Gec Adm")
With ws1
.UsedRange.Offset(1, 0).ClearContents
End With
.Range(.Cells(2, 1), .Cells(LR, "O")).SpecialCells(xlCellTypeVisible).EntireRow.Copy
ws1.Range("A2").PasteSpecial (xlPasteColumnWidths)
ws1.Range("A2").PasteSpecial (xlPasteValues)
End If
.AutoFilterMode = False
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Bookmarks