Automatically fill in other cells based on two dates

gvijaygadde

New Member
Joined
Oct 14, 2009
Messages
1
Hi,

I am trying to write VBA code for my Excel sheet project management sheet.

Example like this: In Column
A1 - Project start date
B1 - Project end date
C1 - Number of days between these two dates - got the formula
Range("A3").Value = DateDiff("d", Range("A1").Value, Range("A2").Value)
D1 - Number of weeks between these two dates
Range("A4").Value = DateDiff("w", Range("A1").Value, Range("A2").Value)

But now my problem, when start adding dates in next rows the above steps on [C2, D2] [C3,D3] should automatically happend fill the values in based on [A2,B2], [A3,B3] respective colums

How can i automatically incriment the Cell referance value.

Many thanks for your and I really appritiate a quick response on this.

Thanks in advance,
Regards,VJAY.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top