Hello
Does any one know how to get a macro to perform a task on all worksheets in a workbook without having to specify each sheet individualy.i.e I have a macro that deletes a row based on a certain criteria and I want it to run in all the worksheets in a workbook.
Also is there an esay way of specifiying a macro to delete all rows where dates in a specific row/cell are older than todays? I have messed around with now and today function and came up with the following but it's a bit long winded.
The way I have done it currently is:
Sub Deleterows()
Dim i As Double
Worksheets("Text").Cells(20, 1) = "=today()" ' INSERTS CURRENT DATE IN THAT CELL
Worksheets("non").Select
For i = 100 To 1 Step -1
If Cells(i, 1).Value < Worksheets("Text").Cells(20, 1) Then _
Cells(i, 1).EntireRow.Delete
Next i
Thanks very much.
Hamnet
Does any one know how to get a macro to perform a task on all worksheets in a workbook without having to specify each sheet individualy.i.e I have a macro that deletes a row based on a certain criteria and I want it to run in all the worksheets in a workbook.
Also is there an esay way of specifiying a macro to delete all rows where dates in a specific row/cell are older than todays? I have messed around with now and today function and came up with the following but it's a bit long winded.
The way I have done it currently is:
Sub Deleterows()
Dim i As Double
Worksheets("Text").Cells(20, 1) = "=today()" ' INSERTS CURRENT DATE IN THAT CELL
Worksheets("non").Select
For i = 100 To 1 Step -1
If Cells(i, 1).Value < Worksheets("Text").Cells(20, 1) Then _
Cells(i, 1).EntireRow.Delete
Next i
Thanks very much.
Hamnet