Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How would I write a macro to insert the results of the formula below into Cell G10. I need to return the number of days between today and the date entered in E10.
    I also need it to be a "change event". I think!


    =IF(E10="","",NOW()-E10)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can use code like this:

    Code:
    Sub MyMacro()
      Range("G10").Formula = "=IF(E10="""","""",TODAY()-E10)"
    End Sub
    Note that the quotes within the formula have been doubled. This is necessary whenever you need quotes within a quoted string in code.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •