Solved

VBA Excel Gantt

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

912 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now