W
Will
My Goal:
Run a Macro that will scan a worksheet and if the word "Accounting" is not
in the "M" column of a Row then delete that Row.
Here is what I have now. It scans the Worksheet but does not delete the rows:
Sub Make_one_sheet_per_dept()
'
' Make_one_sheet_per_dept Macro
' Macro recorded 6/2/2008 Totals each department onto it's own worksheet.
'
'
Sheets("Accounting").Select
Dim rngTotal As String
For i = 5000 To 1 Step -1
rngTotal = Range("M" & i).Select
rngTotal = Range("M" & i).Value
'rngTotal = Trim(rngTotal)
If rngTotal = "<>Accounting" Then
Rows(ActiveCell.Row).Select
Selection.Delete shift:=x1Up
End If
Next i
End Sub
Thanks Will
Run a Macro that will scan a worksheet and if the word "Accounting" is not
in the "M" column of a Row then delete that Row.
Here is what I have now. It scans the Worksheet but does not delete the rows:
Sub Make_one_sheet_per_dept()
'
' Make_one_sheet_per_dept Macro
' Macro recorded 6/2/2008 Totals each department onto it's own worksheet.
'
'
Sheets("Accounting").Select
Dim rngTotal As String
For i = 5000 To 1 Step -1
rngTotal = Range("M" & i).Select
rngTotal = Range("M" & i).Value
'rngTotal = Trim(rngTotal)
If rngTotal = "<>Accounting" Then
Rows(ActiveCell.Row).Select
Selection.Delete shift:=x1Up
End If
Next i
End Sub
Thanks Will