• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

NOW() formula using VBA

sn152

Member
Hi All,

I am trying to enter the Now() formula with VBA code. In the attached workbook, in column A I have a list of dates. In column B I want to enter the formula Now()-the date in column A.
The problem is the range gets changed everyday and I am not sure how to enter formula using VBA code only for the used range.
Please helpe me.

Thanks in advance!
 

Attachments

  • Sample.xlsx
    26.8 KB · Views: 0
Check this.

Code:
Sub now_date()
[b1] = "Age"
Application.Index(Range("A2").CurrentRegion, , 2) = Now
[b1] = "Age"
End Sub
 
Hi Deepak,
Thanks for your reply. This code is entering today's date in the column B. But what i want in column B is to fill formula =NOW()-A2 and in the next line =NOW()-A3 and so on.
 
Back
Top