Automaticly add an amount

mdcory

Registered User.
Local time
Today, 04:43
Joined
Sep 28, 2004
Messages
73
Hi all,
I am trying to figure out how to insert a number based a few things. I'll get right down to it.

This is what I have.

Column A Column B Column C
Description Amount Date entered

I need to find the latest date where column A = "house" then I need to see if it is greater than 14 days from today. If it is then a new row with column A house column B 178 and column C todays date. I also would like to have this run when it is opened. I have figured out how to find the max date with house but not how to get it to figure out the date thing.

Any help is greatly appreciated,
Thanks,
Matthew
 
try this function:
Code:
sub workbook_open

dim r as range, dte as date

  for each r in range("c2", range("c2").end(xldown))
    if r.offset(0, -2) = "house" then
      if r > r.offset(-1, 0) then
        dte = r
      end if
    end if
  next r

  if datediff("d", date(), dte) > 14 then
    range("a2").end(xldown).offset(1, 0) = "house"
    range("b2").end(xldown).offset(1, 0) = 178
    range("c2").end(xldown).offset(1, 0) = date()
  end if

end sub
 

Users who are viewing this thread

Back
Top Bottom