Deleting all rows below a certain level
Posted on 2012-03-15
I have a simple delete macro that deletes all "unlocked records in a set of rows.
I need the ability to ask the user if they want to clear all data or reset the model. In the case of clearing all data, I need to expand the range below to include any fields that are not "locked" which I think I can do by simply changing "C3:AD5" to "C3:AD" (do I have to give it a number?). However, what line(s) of code would I use in the case of a "reset", that would delete all rows below C5?
Here is the current code (In "This Workbook";
Dim r As Range
For Each r In ActiveSheet.Range("C3:AD5")
If Not r.Locked Then
ActiveSheet.Range("AB3") = ""