Solved

VBA Excel Gantt

Posted on 2016-10-04
1
61 Views
Last Modified: 2016-10-19
There is a ActiveProjects sheet with hundreds of projects.
I've attached Final Result and Source files (samples with small sample data).

I'm building the Excel VBA app that will do these steps:


1) Locate and select the correct file with the Raw Data.

2) Open the Template.

3) Select the data from the Range.

4) Clear current Gantt.

5) Select Relevant data from the Raw data and populate first 4 Columns of Gantt.
   - Project Name
   - Budget
   - TCI PM
   - Assisting

6) Run vba code to populate colored horizontal bars of Gantt chart.
   a) populate squares (cells) in proper Q (ex. 2Q 2016) based on the dates from Raw Data.
   b) add new YEAR if necessary (need 6 consecutive years).
   c) drop one YEAR if 1Q-4Q has no colored cells from top to bottom.

I want to see what is the best solution (must use VBA) to select data from the source and based on the dates - color the Cell with one of the 4 colors (Green, Yellow, Orange, Blue). That's all in step 6a.
Gantt.PNG
ActiveProjects.xlsx
0
Comment
Question by:CABRLU63
1 Comment
 
LVL 1

Accepted Solution

by:
Vijay R earned 500 total points
ID: 41828539
Hi
Good solution is to use the find() method. I am providing the snippet of code I have done in my project:
  On Error GoTo Errorcatch
     tasks = Split(taskText, ",")
     taskCount = 0
    For taskno = 0 To UBound(tasks)
        With monitorSheet.Range(Cells(BaseRow, 1), Cells(BaseRow + 41, 1))
           Set found = .Find(tasks(taskno), LookIn:=xlValues)
        End With
        If Not found Is Nothing Then
            With Cells(found.Row(), columnNo)
                .Value = "="
                If found.Row() < 23 Then
                    .Interior.Color = RGB(255, 153, 0)
                Else
                    .Interior.Color = RGB(204, 51, 0)
                End If
I hope this helps. Let me know if it is not clear.
Vijay R
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question