• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Excel VBA gannt chart IF Loop match function problem

anthonius2015

Junior Member
Dear,

I have a gannt chart starting from row 11 with in;
column B = description (longer than cell length)
column C = start date (can be each day of the week)
column D = duration in days

Column E till MM in row 10 = calendar day starting each week on a Monday

I am trying to add in each row the description in a cell after the "start date + duration days".


The problems I am facing after hours and days googling and experimenting;

- My description text doesn't fit in the cell and doesn't continue in the other cells.
- I cant seem to get it working to add the description from each row in the appropriate cell in the correct row.


I want to solve this with VBA, but I need your help. My "range" runs completely on conditional formatting and I would like to keep this this way.

Thanks in advance, hope fully you can point me in the correct position.
Its getting frustrating now, as I am starting to learn VBA.


Regards,
Anthonius
 
I do VBA development and I am not sure what you're getting at. A cell can hold about 32k characters in text, which is a lot of characters. Do you need to widen the cell to display the description? Otherwise if you need more than 32k characters, you'll have to split the text into 32k chunks.

I can't really figure out what you're asking for, perhaps a link to an example file would help.
 
Dear Tweak155,

Thanks for replying that quick.
See the link for an example file, hopefully this makes it clear.
http://www.dropbox.com/l/nL0TqU8OPK6PlJq5F8vpLr

I am embarrassed, I figured it out with the text. One of my conditional formatting rules was incorrect.

In the example file, you can see in row 13 a description text (C13), this needs to be in all other rows starting from row 10 till there is no value anymore in column C.
For example row 10 should match C10), row 27 should match (C27).

I don't know how to explain it correctly as I believe that I make it to complicated.

I still have more issues, but I want to try it first myself (learning curve).


I did read already many of your posts, and you deserve a compliment!

Thanks.
 
I think maybe I get it... you want the description to appear on the calendar in the location of Start Date + Duration? Run this on your test document you uploaded and tell me if it gives you the result you want?

Code:
Sub fillInDatesOnCalendar()

Const strFormat As String = "MM/DD/YYYY"

Dim dtDate As Date

Dim dic As Object, lngCol As Long
Set dic = CreateObject("scripting.dictionary")
Dim rngLoop As Range

With ThisWorkbook.Sheets("test")
    For Each rngLoop In .Range(.Cells(8, "J"), .Cells(8, .Columns.Count).End(xlToLeft))
        dtDate = rngLoop.Value
        dic.Add Format(dtDate, strFormat), rngLoop.Column
    Next rngLoop
    For Each rngLoop In .Range(.Cells(10, "C"), .Cells(.Rows.Count, "C").End(xlUp))
        dtDate = .Cells(rngLoop.Row, "D") + .Cells(rngLoop.Row, "E")
        If dic.exists(Format(dtDate, strFormat)) Then
            .Cells(rngLoop.Row, dic(Format(dtDate, strFormat))).Value = .Cells(rngLoop.Row, "C").Value
        End If
    Next rngLoop
End With
End Sub
 
Back
Top