Grazie!
Function GiornoNonLavorativo(dtmMiaData As Date, _
Optional SabatoNonLav As Boolean = False, _
Optional dtmPatrono As Date = "1-gen") As Boolean
GiornoNonLavorativo = False
Select Case Format(dtmMiaData, "d-mmm")
Case Is = "1-gen", "6-gen", "25-apr", "1-mag", "2-giu", "15-ago",
_
"1-nov", "8-dic", "25-dic", "26-dic", Format(dtmPatrono, "d-mmm")
GiornoNonLavorativo = True
Exit Function
End Select
Select Case WorksheetFunction.Weekday(dtmMiaData, 2)
Case Is = 7
GiornoNonLavorativo = True
Exit Function
Case Is = 6
If SabatoNonLav = True Then
GiornoNonLavorativo = True
Exit Function
End If
End Select
If WorksheetFunction.Weekday(dtmMiaData, 2) = 1 Then
If Month(dtmMiaData) = 3 Or Month(dtmMiaData) = 4 Then
If dtmMiaData = EASTER(Year(dtmMiaData)) + 1 Then
GiornoNonLavorativo = True
Exit Function
End If
End If
End If
End Function
Function EASTER(Yr As Integer) As Long
' Dal sito:
'http://longre.free.fr/pages/form/dateheure.htm#Jours_fériés.
Dim Century As Integer
Dim Sunday As Integer
Dim Epact As Integer
Dim Golden As Integer
Dim LeapDayCorrection As Integer
Dim SynchWithMoon As Integer
Dim N As Integer
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = _
(11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) _
Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function
Ciao Elio
lo puoi fare anche con "formattazzione condizionale"
ciao
p.s. se hai date nel formato xx/xx/xx ti posso dire come
"filippo" <filip...@tin.it> ha scritto nel messaggio
news:4855e94a$0$40315$4faf...@reader5.news.tin.it...
Grazie!
"elby" <elib...@tin.it> ha scritto nel messaggio
news:b1b20192-db61-418a...@8g2000hse.googlegroups.com...
"filippo" <filip...@tin.it> ha scritto nel messaggio
news:4855e94a$0$40315$4faf...@reader5.news.tin.it...
"elby" <elib...@tin.it> ha scritto nel messaggio
news:d7546202-7018-4ba6...@79g2000hsk.googlegroups.com...
"magomerlino" <magomerl...@libero.it> ha scritto nel messaggio
news:q8C5k.9978$Ca.1...@twister2.libero.it...
> Gentile elby, quando avvio la macro i giorni di maggio 2008 che mi
> compaiono in grassetto sono:
> 6-7-8-10-11-14-15-16-17-18-20-21-25-26-27-31
> mentre voglio che mi compaiano solo i festivi da calendario:
> 1-4-11-20-25 ed in più il 9 (festa patronale) Non l'8 mag .
> >
>
>
>
On 17 Giu, 01:05, "magomerlino" <magomerlino.1...@libero.it> wrote:
> Scusami elby rettifico le date , i giorni di maggio 2008 che mi
> compaiono in grassetto sono:
> 1-4-6-7-8-9-10-11-14-15-16-17-18-20-21-25-26-27-31
> mentre voglio che mi compaiano solo i festivi da calendario:
> 1-4-11-20-25 ed in più il 9 (festa patronale) .
> Ripeto Per la formattazione condizionale infatti ho inserito:
> =GiornoNonLavorativo($E5;FALSO;"9-mag")
> N.B. E5 in quanto i dati partono dalla riga 5
>
> "magomerlino" <magomerlino.1...@libero.it> ha scritto nel messaggionews:q8C5k.9978$Ca.1...@twister2.libero.it...
>
> > Gentile elby, quando avvio la macro i giorni di maggio 2008 che mi
> > compaiono in grassetto sono:
> > 6-7-8-10-11-14-15-16-17-18-20-21-25-26-27-31
> > mentre voglio che mi compaiano solo i festivi da calendario:
> > 1-4-11-20-25 ed in più il 9 (festa patronale) Non l'8 mag .
>
> > "elby" <elibu...@tin.it> ha scritto nel messaggio
=GIORNO.SETTIMANA(N5;2)=7
fai sapere se hai risolto. ciao
"magomerlino" <magomerl...@libero.it> ha scritto nel messaggio
news:lJx5k.99624$FR.3...@twister1.libero.it...