Forum

Gantt Chart Schedul...
 
Notifications
Clear all

Gantt Chart Scheduler with "today flag" incorrectly showing on the month

3 Posts
2 Users
0 Reactions
76 Views
(@stevenbehr1)
Posts: 92
Estimable Member
Topic starter
 

Hi There,

I have a Gantt chart scheduler and put "Today" flag to represent in the current month the flag will show on the current day.

The formula for this is:CurrDay = Day(Date)
'Set Current Day Marker
.Shapes("TodayGrp").Left = .Cells(6, CurrDay + 7).Left ' 
If Month(Date) <> .Range("B3").Value Then .Shapes("TodayGrp").Visible = msoFalse Else: .Shapes("TodayGrp").Visible = msoCTrue

I have also a Previous and Next month button. with the formula If Month(Date) <> .Range("B3").Value Then .....Visible false because if the prev month "August" the Flag will disapear which is correct. When you go back to September it reappears - which is correct. 

But because the VBA Formula is Else: .Shapes("TodayGrp").Visible = msoCTrue     anything more than September the flag will still be present in Oct +

Is there any other way of representing a flag or is there a way to highlight a column representing "Today" or maybe a Strike of some sort????

This is quite a melon scratcher for me Ive tried various way but no success

I hand you the workbook attached

Thanks

 

Steve behr

 
Posted : 03/09/2021 8:56 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Steven,

You have to specify all possible scenarios to view or hide that shape, If-Then-Else might not be enough. use ElseIf:

If Month(Date) <> .Range("B3").Value Then

.Shapes("TodayGrp").Visible = msoFalse

ElseIf condition 2

.Shapes("TodayGrp").Visible = msoCTrue

ElseIf condition 3

.Shapes("TodayGrp").Visible = msoCTrue

Else

...

End if

 
Posted : 14/09/2021 12:18 am
(@stevenbehr1)
Posts: 92
Estimable Member
Topic starter
 

Very Good Catalin,

That works well, thats great.

Been annoying me for 3 weeks!

 

Thanks

 

Steve

 
Posted : 15/09/2021 7:25 pm
Share: