Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Location
    Guisborough, United Kingdom
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel VBA - horizontal time/date bars(as in Chart)

    Hi there all,
    I want to use a spreadsheet as a Gantt chart - ie - start and end dates and times displayed as colored horizontal(rows-cells) bars.
    Help
    Thank
    Mike S

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel VBA - horizontal time/date bars(as in Chart)

    See for example Gantt chart on a worksheet on the Mr Excel site.
    Also see Jon Peltier's Gantt Chart
    The old thread starting at <post:=27,053>post 27,053</post:> has some links that might be useful (the first link doesn't work any more, but the others do).

  3. #3
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel VBA - horizontal time/date bars(as in Chart)

    In the postings you refer to there is a link to Q123260 which shows some vba code to create the charts. I have been playing around with it and have noticed that every time you create a chart the default setting for dates is 50 days apart. I assume that this is controlled by the MajorUnitIsAuto=True. Can this be set to some value other than True/False? If so, can code be set to ask what the value should be?

    Thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel VBA - horizontal time/date bars(as in Chart)

    If you type MajorUnitIsAuto in the Visual Basic Editor (for example in the Immediate window) and press F1, you'll get help on this property. You'll see that it can only be set to True or False, but you'll also see a reference to the MajorUnit property. If you specify a value for MajorUnit, MajorUnitIsAuto will automatically be set to False.

    You can use (for example)

    With ...
    ...
    .MajorUnit = Application.InputBox(Prompt:="Enter the major unit", Type:=1)
    ...
    End With

Posting Permissions

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