I was wondering if there is a workaround to not retype the code if a deeper select case dont' match the criteria.
I have to check whether the Month is one of those stated below, if it is I have to check if the day of that month match with the criteria. If the day dont match any case, the code that have to run is the one set in the above Select statement in the ELSE case.
The only way I know to workaround this is by using and IF statement instead of the nested select case and using a GO TO LABEL to bring me back to the CASE ELSE statement but it seems very unclassy.
Is there a way not to retype the same code in the else case if the deeper select case dont match the criteria ?
Select Case Month(Range("b" & Start))
Case 1
Case 4
Case 5
Case 6
Case 8
GiornoMese = listaattiva(j).Text & "/" & Month(Range("b" & Start)) & "/" & Year(Range("b" & Start))
Select Case Day(GiornoMese)
Case 15
**HERE IF THE DAY IS NOT THE 15th
CODE SHOULD JUMP OUT AND RUN CODE TYPED
IN THE CASE ELSE STATEMENT**
Case 12
Case Else
'Debug.Print listaattiva(j).Text & "/" &
'Month (Range("b" & Start)) & "/" & Year(Range("b" & Start))
GiornoMese = listaattiva(j).Text & "/" & Month(Range("b" & Start)) & "/" & Year(Range("b" & Start))
If Weekday(GiornoMese, vbMonday) = 7 Then
'Domenica - Tutte le ore del giorno sono F3
For Each quarto In listaattiva(j).Attributes
'Debug.Print listaattiva(j).Attributes.Length
'Debug.Print quarto.Text
F3 = F3 + quarto.Text
'Debug.Print F3
Next
Aucun commentaire:
Enregistrer un commentaire