Private Sub Workbook_Open() ' # aangepast 20-02-2020
Dim a As Integer, i As Integer, KortMaand As String, LZ As Date, EZ As Date, HD As Date, EBDat As Date
Maand(1) = "Januari" ' # bij de maanden Juni & November wordt de vlag
Maand(2) = "Februari" ' # Vlag Nood Exit Value = 1 gezet
Maand(3) = "Maart" ' # en aan het eind wordt de vlag
Maand(4) = "April" ' # Vlag Nood Exit Value = 0 gezet.
Maand(5) = "Mei" ' # Tevens ook aan het eind de Vlag Periode Value = 1 gezet
Maand(6) = "Juni"
Maand(7) = "Juli"
Maand(8) = "Augustus"
Maand(9) = "September"
Maand(10) = "Oktober"
Maand(11) = "November"
Maand(12) = "December"
AantalWK = 65 ' Aantal Speelweken p/jaar + 17 weken (4 MND overbrugging)
Sheets("Control").Unprotect ' haalt de beveiliging van het blad
Sheets("Contributie").Unprotect ' haalt de beveiliging van het blad
Application.ScreenUpdating = False ' tegen flikkeren van beeldscherm
With Worksheets("Control")
AantalDN = .Range("J10").Value ' leest het Aantal Active Deelnemers in van wb Control!J10
MaxAantalDN = .Range("J24").Value ' leest het Max Aantal Deelnemers in van wb Control!J24
mnd = .Range("C10").Value ' Leest het maandnummer in op wb Control cel C10
FreqVar = .Range("Q8").Value ' leest de waarde van frequentie [FreqVar] in
LETVar = .Range("Q10").Value ' leest de waarde van Lotto Extra Trekking [LETVar] in
MaxOmschr = .Range("Y14").Value ' leest max. regels in bij omschrijving uitgaven
RMO = .Range("Y15").Value ' leest max. regels in bij omschrijving uitgav
AantalSP = .Range("J10") ' leest het Aantal Spelers in van wb Control!J10
MaxAantalSp = .Range("J8") ' leest de laatste regel voor Contributie leden onder Kasboek
a = Len(CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName))
.Range("AI46") = ThisWorkbook.Path & "\" ' Path van dit file met backslash
.Range("AI34") = Left(CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName), (a - (13 + 1))) ' linker gedeelte naam file
.Range("AM34") = Mid(CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName), (a - 13 + 1), 13) ' rechter gedeelte naam file ALTIJD 13
.Range("AO34") = CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName) ' Name van file
ActiveWorkbook.Worksheets("Behang").Range("A1") = Left(CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName), (a - (13 + 1))) ' linker gedeelte naam file
ActiveWorkbook.Worksheets("Behang").Range("C1") = Mid(CreateObject("scripting.filesystemobject").GetBaseName(ThisWorkbook.FullName), (a - 13 + 1), 13) ' rechter gedeelte naam file ALTIJD 13
HD = ActiveWorkbook.Worksheets("Control").Range("C18") ' Huidige Datum
EBDat = CDate(.Range("AM24"))
If EBDat < HD Then .Range("AM24") = "": .Range("AM26") = ""
If .Range("AM22") = 0 Or .Range("AM22") = "" Then .Range("AM24") = "": .Range("AM26") = ""
If .Range("J10").Value > 4 Then .Range("AI36").Value = 1 ' zet VlagStart op 1
.Range("N30") = 0 ' zet Aanloop Fase op 0 om opnieuw in te lezen hieronder
If Maand(mnd) = "Januari" Then KortMaand = "Jan" ' als er min. 5 spelers zijn
If Maand(mnd) = "Februari" Then KortMaand = "Feb"
If Maand(mnd) = "Maart" Then KortMaand = "Mrt"
If Maand(mnd) = "April" Then KortMaand = "Apr"
If Maand(mnd) = "Mei" Then KortMaand = "Mei"
If Maand(mnd) = "Juni" Then
KortMaand = "Jun"
.Range("AI42").Value = 1 ' maakt Vlag Nood Exit Value = 1
End If ' om wb Contributie activate & change event te voorkomen
If Maand(mnd) = "Juli" Then KortMaand = "Jul"
If Maand(mnd) = "Augustus" Then KortMaand = "Aug"
If Maand(mnd) = "September" Then KortMaand = "Sep"
If Maand(mnd) = "Oktober" Then KortMaand = "Okt"
If Maand(mnd) = "November" Then
KortMaand = "Nov"
.Range("AI42").Value = 1 ' maakt Vlag Nood Exit Value = 1
End If ' om wb Contributie activate & change event te voorkomen
If Maand(mnd) = "December" Then KortMaand = "Dec"
.Range("D10").Value = Maand(mnd) ' schrijft maand(tekst) weg op wb Control cel D10
.Range("J12").Value = AantalWK ' schrijft AantalWK weg op wb Control cell J12
.Range("D12").Value = KortMaand ' schrijft maand(kort tekst) weg op wb Control cel D12
.Range("AI34").Value = Left(ActiveWorkbook.Name, a - (13 + 1))
.Range("AM34").Value = " " & Mid(ActiveWorkbook.Name, (a - 13 + 1), 13)
.Range("AI38").Value = 0 ' zet Vlag Jaarom standaard op 0
If .Range("J10").Value >= 15 And .Range("O30") = "0¹" Or .Range("O30") = "0²" Or .Range("O30") = "0³" Then ' is A-Fase 0¹ / 0² / 0³ bereikt?
.Range("AD32") = 1 ' dan switch TP-JackPot op 1
Else
.Range("AD32") = 0 ' anders switch TP-JackPot op 0
End If
If .Range("N30") = 0 And .Range("O30") = "0²" Or .Range("O30") = "0³" Then ' is A-Fase 0² / 0³ bereikt?
.Range("AD33") = 1 ' dan switch Super-JackPot op 1
Else
.Range("AD33") = 0 ' anders switch Super-JackPot op 0
End If
End With
EZ = ActiveWorkbook.Worksheets("Control").Range("C9") ' Eerste Zaterdag van Huidige Maand
LZ = ActiveWorkbook.Worksheets("Control").Range("D19") ' Laatste Zaterdag van Huidige Maand
If HD > LZ Or HD <= EZ Then
If ActiveWorkbook.Worksheets("Data").Range("C86") = "" Then GoTo Door
Application.Goto [Behang!A1] ' gaat naar cel A1 om goed terug te komen
Application.ScreenUpdating = True ' tegen flikkeren van beeldscherm
MemoForm.Show
Application.ScreenUpdating = False ' tegen flikkeren van beeldscherm
End If
Door:
Run KasboekKolom()
ActiveWorkbook.Worksheets("Control").Activate
Run AanloopFase() ' zet de juiste Aanloop Fase neer
Sheets("Control").Unprotect ' haalt de beveiliging van het blad
NoodExit = 1 ' geen activering wb Control
With Worksheets("Kasboek")
If .Range(KBK2 & 7) = "Maart" Then ' als maand is Maart
Sheets("Kasboek").Unprotect ' haalt de beveiliging van het blad
Union(.Range("BP55:BQ79"), .Range("CA55:CB79")).ClearContents ' wist Datum & Omschrijving van Juli & Augustus
Union(.Range("EB46:EB52"), .Range("EM46:EM52"), .Range("EX46:EX52"), .Range("FI46:FI52"), .Range("FT46:FT52"), .Range("GE46:GE52")).ClearContents ' wist de Totalen v/d laatste maanden
Union(.Range("EB16"), .Range("EM16"), .Range("EX16"), .Range("FI16"), .Range("FT16"), .Range("GE16")).ClearContents ' wist de cellen van de Aanloop Fase v/d laatste maanden
Sheets("Kasboek").Protect DrawingObjects:=True, contents:=True, Scenarios:=True ' beveilig blad weer
End If
If .Range(KBK2 & 7) = "Juli" Then ' als maand is Juli
Sheets("Kasboek").Unprotect ' haalt de beveiliging van het blad
Union(.Range("CL55:CM79"), .Range("CW55:CX79"), .Range("DH55:DI79"), .Range("DS55:DT79")).ClearContents ' wist Datum & Omschrijving van September/Oktober/November & December
Sheets("Kasboek").Protect DrawingObjects:=True, contents:=True, Scenarios:=True ' beveilig blad weer
End If
ActiveWorkbook.Worksheets("Control").Range("S8") = .Range(KBK6 & 50) ' zet huidige SP neer op wb Control
ActiveWorkbook.Worksheets("Control").Range("S10") = .Range(KBK6 & 49) ' zet huidige JP neer op wb Control
End With
If (Left(Date, 3) = "1-1" Or Left(Date, 3) = "2-1" Or Left(Date, 3) = "3-1" Or Left(Date, 3) = "4-1" Or Left(Date, 3) = "5-1" Or Left(Date, 3) = "6-1" Or Left(Date, 3) = "7-1") Then ' opschonen file 1e week v/h jaar
With Worksheets("Control")
If .Range("C10").Value = 1 Then ' als de maand is Januari
For i = 1 To 31
If ActiveWorkbook.Worksheets("Contributie").Range("BE" & 7 + i) <> "" Then ' checkt of er al vooruit betaald is
ActiveWorkbook.Worksheets("Control").Range("AI38").Value = 1 ' zet VlagJaarOm --> aan om change event in wb Contributie te voorkomen
JaarOm ' gaat naar sub opschonen van gegevens
Sheets("Control").Unprotect ' haalt de beveiliging van het blad
ActiveWorkbook.Worksheets("Control").Range("AI38").Value = 0 ' zet VlagJaarOm --> uit, alles is opgeschoond
End If
Next i
End If
End With
End If
If (Month(Date) = 1 Or Month(Date) = 2 Or Month(Date) = 3 Or Month(Date) = 4 Or Month(Date) = 5 Or Month(Date) = 6) And ActiveWorkbook.Worksheets("Control").Range("AI38").Value = 0 Then ' als er niet opgeschoond is
For i = 1 To 31
If ActiveWorkbook.Worksheets("Contributie").Range("BE" & 7 + i) <> "" Then JaarOmEnd: Exit Sub
Next i
End If
With Worksheets("Contributie")
If Maand(mnd) = "Juni" Then
.Range("Y49").Value = 1 ' maakt Vlag Periode Value = 1
With Worksheets("Control")
.Range("AI42").Value = 0 ' maakt Vlag Nood Exit Value = 0
End With
End If
If Maand(mnd) = "November" Then
.Range("AU49").Value = 1 ' maakt Vlag Periode Value = 1
With Worksheets("Control")
.Range("AI42").Value = 0 ' maakt Vlag Nood Exit Value = 0
End With
End If
End With
Sheets("DBase").Unprotect ' haalt de beveiliging van het blad
With Worksheets("DBase")
For i = 9 To (ActiveWorkbook.Worksheets("Control").Range("J24").Value + 9)
If .Range("AP" & i) < ActiveWorkbook.Worksheets("Control").Range("C10") Then ' schoont Bonus nieuw lid gegevens op na een mnd
.Range("AN" & i) = ""
.Range("AO" & i) = ""
.Range("AP" & i) = ""
.Range("AQ" & i) = ""
End If
Next i
End With
NoodExit = 0 ' geen activering wb Control uit
Sheets("Control").Protect DrawingObjects:=True, contents:=True, Scenarios:=True ' beveilig blad weer
Sheets("Contributie").Protect DrawingObjects:=True, contents:=True, Scenarios:=True ' beveilig blad weer
Sheets("DBase").Protect DrawingObjects:=True, contents:=True, Scenarios:=True ' beveilig blad weer
[COLOR="#FF0000"] Worksheets("Control").Visible = 0
Worksheets("Data").Visible = 0
Worksheets("Spelers").Visible = 0
Worksheets("DBase").Visible = 0
Worksheets("Kasboek").Visible = 0
Worksheets("Contributie").Visible = 0
Worksheets("PrntXDocLS").Visible = 0 ' LandScape
Worksheets("PrntXDocPT").Visible = 0 ' PorTrait[/COLOR]
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" ' verbergd de formulebalk bij opstarten
Application.DisplayFormulaBar = False
Application.Goto [Start!A1] ' Gaat naar wb Start cel A1
Application.ScreenUpdating = True ' tegen flikkeren van beeldscherm
End Sub