• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Show dates corresponding to the activity

Visor

Member
Show dates by activity
Dear friends of the forum, the following thing seems to me to be even more complicated, at least for me, what I want is to show the dates according to the activities that are seen in the combobox4
This causes the combobox 1, 2 and 3 to be activated but I would like them to be seen according to the corresponding dates, in the header the correspondence day is shown or also called "HOUR-"
I describe the words:
DIAS = the day you have the activity during the week
HORAS = the number of hours assigned to execute the activity.
HORARIO= the Schedule or time of the day when the activity must be executed

Example: If I select the activity MICROB I 3A Lab Clinico in the combobox4, it corresponds to me on Monday

So, in the combobox1 show:
10/16/2017
10/18/2017
In the first week, (this is selected combobox2)

the dates,..
10/19/2017
10/20/2017

I do not have that activity anymore
What I want to do next is that
When I select the example date 10/16/2017 I want you to only show me the two textbox what corresponds to that week

Thanks in advances
I upload a exampla file
 

Attachments

  • POR ACTIVIDADES ACADEMICAS Y DE COMISION V1.xlsm
    64.1 KB · Views: 2
Regards!!
I am not sure that a topic has been understood, or perhaps in the uploaded file I must eliminate code that does not correspond to be better understood. However I do not know if, if it has been understood but this issue can not be solved or can not be done.
I would like to know
 
Pretty much anything you can imagine doing in Excel is possible via VBA. In most cases, if your post doesn't get a response, it's likely due to following.

1. Question isn't clear and/or required outcome of code is unclear.
2. Sample workbook contains a lot of procedures in there already and makes it difficult to understand the process.
etc.

I'd always recommend stripping down sample workbook to only the portion that pertains to the question. Detailing step by step what the code should do. If unable to strip down (i.e. you need help on intermediate step etc) then, you should point out where in code you are having issue.
 
Thank you, that's what I was thinking, I've reduced the content of the information to see if I improve the situation of the file and then.
Now I think it's better.

I have left the comboboxes to show that all the dates are loaded, but I want only the dates that match the activity to be shown. In the first rows it is shown in which days correspond to the activity that must correspond with the dates to be shown in the combobox3
Example if I select the first activity and select the month of October it should show only the dates of that activity; and if I also select week 1 ,. The date will be shown 10/16/2017 and 10/18/2017 (for the week 1)
 

Attachments

  • POR ACTIVIDADES ACADEMICAS Y DE COMISION V2.xlsm
    57.7 KB · Views: 4
Hmm, I'd suggest you give some example of desired result and explain logic of your process.

I'm guessing that when row is blank for "MICROB I 3B MEDICINA" column, you don't want it appear when it's picked in dropdown. But am not certain.

As well, I'd recommend flattening your table, if possible. Cross tab structure isn't ideal for working with data via formula/code.
 
So... you don't need Semana and Mes combobox but only the date one. And for that to be filtered for corresponding ones from list?

Please do give detailed explanation of your requirement.
 
Something like below then.
Code:
Private Sub ComboBox4_Change()
Dim myArr, wkArr, diasArr
Dim lArr(), rArr()
Dim y As Long, i As Long
y = ComboBox4.ListIndex
With Sheets("ACAD")
    myArr = .Range("B9:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
    diasArr = .Range(.Cells(3, (y + 1) * 3), .Cells(7, (y + 1) * 3)).Value
    Sheet2.Range("A1").Resize(, UBound(diasArr)) = diasArr
End With
y = 1
wkArr = Array("LUNES", "MARTES", "MIÉRCOLES", "JUEVES", "VIERNES")
For i = 1 To UBound(diasArr)
    If Len(diasArr(i, 1)) > 0 Then
        ReDim Preserve lArr(y)
        lArr(y - 1) = Application.Match(diasArr(i, 1), wkArr, 0)
        y = y + 1
    End If
Next
y = 1
For i = 1 To UBound(myArr)
    x = Application.Match(Weekday(myArr(i, 1), vbMonday), lArr, 0)
    If IsNumeric(x) Then
        ReDim Preserve rArr(y)
        rArr(y - 1) = myArr(i, 1)
        y = y + 1
    End If
Next

With ComboBox3
    .Clear
    .List = rArr
End With
End Sub

Private Sub UserForm_Initialize()
With ComboBox4
  For y = 3 To 33
      If Trim(Cells(2, y)) = "DIAS" Then
        .AddItem Cells(8, y)
      End If
  Next
End With
End Sub
 
It is very great!!
It is just as I need

It is a code that will take me a long time to understand it, it is great I thank you very much, and especially for the patience of dedicating to this subject it has saved me a lot of work because I must find each date according to the day ... match I see that it is very useful
isssu resolved
Thanks you
 
Back
Top