timeline

jasman

Board Regular
Joined
Oct 30, 2010
Messages
141
Hi. I need to create gantt chart style timeline template in Excel.

I was thinking of creating an input box fr the user which asks the start date and end date and then I need excel to put along the top row the dates between the two.

Is there anyway to do this through a macrocode?

thanks
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG12May28
[COLOR="Navy"]Dim[/COLOR] odts [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Dt1 [COLOR="Navy"]As[/COLOR] Date
[COLOR="Navy"]Dim[/COLOR] Dt2 [COLOR="Navy"]As[/COLOR] Date
[COLOR="Navy"]Dim[/COLOR] Ac [COLOR="Navy"]As[/COLOR] Date
[COLOR="Navy"]Dim[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]
[COLOR="Navy"]On[/COLOR] [COLOR="Navy"]Error[/COLOR] [COLOR="Navy"]Resume[/COLOR] [COLOR="Navy"]Next[/COLOR]
 odts = Application.InputBox(prompt:="Please Intert dates as:- 15/2/2011-20/3/2011 ", Title:="Insert Dates", Type:=2)
[COLOR="Navy"]If[/COLOR] odts = "" Or odts = "False" [COLOR="Navy"]Then[/COLOR] [COLOR="Navy"]Exit[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Dt1 = Split(odts, "-")(0)
Dt2 = Split(odts, "-")(1)
    [COLOR="Navy"]If[/COLOR] IsDate(Dt1) And IsDate(Dt2) [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]For[/COLOR] Ac = Dt1 To Dt2
            c = c + 1
            Cells(1, c) = Ac
        [COLOR="Navy"]Next[/COLOR] Ac
    [COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Hi. I have found and tried the folowing code in which i add a date to c4 and then drag this formula along row 4. It works but it mises a column between the dates? any reason why?

=IF(MOD(COLUMN(),2)=0,"",IF(MONTH($C4+INT(COLUMN()/2))=MONTH($C4),C4+1,""))
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

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