Hi Michelle,
A lot of what the code does is explained in
http://www.mvps.org/dmcritchie/excel/proper.htm
though I did not put in code to make it run faster.
Sub the beginning of a macro, the name of the
macro follows. A parameter list follows that, and
there are no parameters.
Dim is short for dimension and is used to declare
variables. The variable Rng is a Range of cells.
The variable I is an integer (32 bits as opposed to 16 bits).
Dates are measured in days past a certain date (Dec 31, 1899
for the 1900 date system), and time is measured as fractions of
a day. So INT(NOW) removes the fractional part of the
datetimestamp obtained from NOW.I. .
Set rng = Intersect(Range("A:A"), _
ActiveSheet.UsedRange.SpecialCells(xlConstants, xlNumbers))
the underscore (space underscore) indicates that the next line
is a continuation of the current line. Intersect is taking two ranges
and the resulting range (does not have to be contiguous) is comprised
of cells that exist in both of the ranges. So a cell must be in column AS
and it must be a constant with a number (no formulas, text, space or empty
cells). SpecialCells in itself is limited to the used range.
For i = rng.Count To 1 Step -1
This is a loop and for inserting/deleting rows we want to start from
the bottom and work our way up so we don't skip over rows.
Rng.Count is a count of items in a collection of cells named Rng.
The Step -1 is a negative increment (we are going from bottom to top)
so it starts out high and decremnts to 1.
rng.item(i) is a specific item in the range Rng specicall the i-th item.
The .value indicates we are checking the value of the item not
..text which woujld be the displayed or formatted value, not address which
would be the cells address, nor a heck of a lot of other choices.
(Int(Now) - 1) is yesterday's date starting at midnight which is considered
on computers to be part of the same day as one minute after midnight.
as a time of 00:00 zero hours, zero minutes. Anything before that
would be considered two days old -- going by days not by time.
EntireRow is used to mean the entiere row as opposed to the
default which would be one cell, if deleting.
Next is the end of the loop and returns to the the For statement for
an increment of test to see if it is finished; otherwise, continues one
more iteration of hte loop, which will be retested again and again, til done.
End Sub the end of the macro.
Don't know if that helps, but if you have no experience with
any programming language you might be better off purchasing a book..
I would look over some VBA tutorials first so you actually purchase
a book you can use as a reference instead of something too elementary.
http://www.mvps.org/dmcritchie/excel/excel.htm#tutorials
Another approach would be to just use the macros until you find they
don't do what you want, as soon as you change one line -- you are
a programmer (oops, I think that is developer now).
The macro previous to this one had Ucase which is upper case
Basically things in in VBA are case sensitive and things in
Worksheet functions are case insentive. There are exceptions in
both.
http://www.mvps.org/dmcritchie/excel/string.htm#sensitivity