Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VBA Excel Gantt

Posted on 2016-10-04
1
67 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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