Problème avec un code Vba Excel
Bonjour à tous,
Voilà, j'ai écrit ce code qui me permets lors d'un click dans une cellule d'afficher un formulaire. Les cellules correspondant à un week-end sont inactives.
Mais je dois avoir un problème quelque part car ça ne marche pas.
Les jours sont sur les lignes 4 et 5, les noms à partir de la ligne 6 colonne A
Pouvez-vous m'aider à comprendre s'il vous plait ?
Merci par avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Col As Long
Dim Lig As Long
Dim A As Long
If Intersect(Range("ZO1"), ActiveCell) Is Nothing Then Exit Sub
If IsEmpty(ActiveCell.Value) Then
Lig = 6
Col = ActiveCell.Column
A = Cells(Lig, Col).Value
If A = 0 Then Col = Col - 1
If Weekday(Cells(Lig, Col).Value) <> 1 And Weekday(Cells(Lig, Col).Value) <> 7 Then
Load FrmAbs
FrmAbs.Show
End If
End If
End Sub |