+ Reply to Thread
Results 1 to 3 of 3

Gantt Chart - Short Time Interval (0.1s) and Colorful Bars needed

  1. #1
    Registered User
    Join Date
    05-01-2014
    Location
    Taiwan, Taichung
    MS-Off Ver
    Excel 2010
    Posts
    7

    Smile Gantt Chart - Short Time Interval (0.1s) and Colorful Bars needed

    Hi all,

    I am a VBA newbie, and need to make a Gantt chart for tact time table.
    There are few problems below I can not figure out, so please help me if you have time, REALLY appreciate your kind reply!!

    (1) I can not solve the Macro "unstop running" by the Object "Range.End.Column", (Range.End.Row works fine to me)
    so I REM them and using actual cell numbers for last Column.(it's not elegant and ugly, I know)

    (2) Try to use Interior.Color to make the color of every generating cell can be the same color of corresponding cell in column "Type", but it just won't work...

    (3) The speed of Macro processing is slow to me. Maybe it just because too many cells in a row?!(over 500 cells in a row, and I need 1500+ later...)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Gantt Chart - Short Time Interval (0.1s) and Colorful Bars needed

    Delete the 0 and 1 values from your columns, and use these macros - only looping on rows.

    Option Explicit

    Sub gantt_chartHalfSec()

    Dim i As Integer

    For i = 3 To 19
    Cells(i, 6).Offset(0, Cells(i, 5) / 0.5).Resize(1, (Cells(i, 6) - Cells(i, 5)) / 0.5).Interior.Color = Cells(i, 3).Interior.Color
    Next i

    End Sub
    Sub gantt_chartTenthSec()

    Dim i As Integer

    For i = 3 To 19
    Cells(i, 6).Offset(0, Cells(i, 5) / 0.1).Resize(1, (Cells(i, 6) - Cells(i, 5)) / 0.1).Interior.Color = Cells(i, 3).Interior.Color
    Next i

    End Sub
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-01-2014
    Location
    Taiwan, Taichung
    MS-Off Ver
    Excel 2010
    Posts
    7

    Talking Re: Gantt Chart - Short Time Interval (0.1s) and Colorful Bars needed

    Hi Bernie,

    Deeply appreciate and thanks so much!!

    Your Macro has lightning speed, awesome!!

    And I just added "+0.5"(and "+0.1" for another Macro) in your code for making every bar could follow previous one more closely:
    Cells(i, 6).Offset(0, Cells(i, 5) / 0.5).Resize(1, (Cells(i, 6) - Cells(i, 5)+0.5) / 0.5).Interior.Color = Cells(i, 3).Interior.Color

    THANK YOU AGAIN ^_^y

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 06-21-2013, 10:57 AM
  2. Replies: 5
    Last Post: 05-20-2011, 10:00 AM
  3. Shading weekends in Gantt chart bars
    By neobavesten in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-01-2010, 07:34 AM
  4. Conditional formatting gantt chart help needed
    By kelly3000 in forum Excel General
    Replies: 2
    Last Post: 01-05-2010, 08:00 AM
  5. Bars in Gantt chart showing values of certain cells?
    By darelooney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2008, 10:10 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1