help w/deleting rows if 2 conditions & calling macro from other bo
Hi,
If you don't mind moving from one workbook to the other:
Sub DeleteRows()
Application.ScreenUpdating = False
Windows("Raw.xlsx").Activate
Sheets("Sheet1").Select
Columns("L:L").Insert
Range("L1:L" & [A1048000].End(xlUp).Row).Select
Selection = "=IF(OR(RC[-5]<""Attendance"",RC[-2]=""""),TRUE,1)"
Selection.SpecialCells(xlCellTypeFormulas, 4).EntireRow.Delete
Columns("L:L").Delete
Windows("Book1").Activate
End Sub
Note in this case the starting workbook is Book1, you would change that in
your code.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"Mayte" wrote:
hi, i found the code below and it works when i'm in the same workbook but how
do i modify it so that i call from book 1 and it works on book 2. i also need
to add a second condition .... any ideas??
what i want to do is delete all rows that DON'T have "Attendance" in column
G and aferwards delete all rows that are "blank" in column J
the macro will be called from the master.xls BUT will work on another file
called raw.xls
Sub stantial()
Dim myrange, MyRange1 As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Sheets("Sheet1").Range("A1:A" & lastrow)
For Each c In myrange
If UCase(c.Value) = "TEST" Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If
End Sub
|