Wampie Beukies
Gebruiker
- Lid geworden
- 7 sep 2009
- Berichten
- 88
Hi All,
Bij de volgende code krijg ik de foutmelding "End With zonder With" , terwijl deze volgens mij keurig in paren staan.
Wat gaat hier mis?
Bij de volgende code krijg ik de foutmelding "End With zonder With" , terwijl deze volgens mij keurig in paren staan.
Code:
Sub Opslaan()
'
' Opslaan Macro
'
'
With Sheets("Verlofkaart")
If Not Dir("E:\Scauting\Planning\" & (.Range("AI1")) & "\" & "Verlofplanning" & ".xlsm") <> "" Then
MsgBox "Maak eerst een bestand 'verlofplanning' voor dit kalenderjaar!"
End With
Exit Sub
With Sheets("Verlofkaart")
Workbooks.Open Filename:="E:\Scauting\Planning\" & (.Range("AI1")) & "\" & "Verlofplanning.xlsm"
End With
Application.Run "Verlofplanning.xlsm!Unprotect"
Windows("'Nieuwe ambulant'.xlsm").Activate
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Windows("'Nieuwe ambulant'.xlsm").Activate
With Sheets("Verlofkaart")
Workbooks.Open Filename:="E:\Scauting\Planning\" & (.Range("AI1")) & "\Verlofplanning.xlsm", _
UpdateLinks:=3
End With
Windows("'Nieuwe ambulant'.xlsm").Activate
Sheets("Verlofkaart").Select
ActiveSheet.Unprotect
Sheets("Verlofkaart").Copy After:=Workbooks("Verlofplanning.xlsm").Sheets(2)
Windows("'Nieuwe ambulant'.xlsm").Activate
Range("A1:AH36").Select
Selection.Copy
Windows("Verlofplanning.xlsm").Activate
Range("A1:AH36").Select
ActiveSheet.Paste Link:=True
Windows("'Nieuwe ambulant'.xlsm").Activate
Range("AI1:AM9").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Verlofplanning.xlsm").Activate
Range("AI1:AM9").Select
ActiveSheet.Paste Link:=True
Sheets("Verlofkaart").Select
ActiveSheet.Name = Range("AJ1").Value
Range("AJ1").Select
Selection.ClearComments
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Delete
ActiveSheet.Protect
ActiveSheet.Visible = False
Windows("'Nieuwe ambulant'.xlsm").Activate
Sheets("Verlofkaart").Select
ActiveSheet.Unprotect
Range("AJ1").Select
Selection.ClearComments
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Delete
Application.DisplayAlerts = True
With Sheets("Verlofkaart")
ActiveWorkbook.SaveAs Filename:="E:\Scauting\Planning\" & (.Range("AI1") & "\" & "Ambulanten" & "\" & (.Range("AJ1")) & ".xlsx"), FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End With
ActiveSheet.Protect
Windows("Ambulantenplanning.xlsm").Activate
Sheets(Array("Ambulanten", "Planning", "Verlofkaart")).Select
Sheets("Ambulanten").Activate
ActiveWindow.SelectedSheets.Visible = False
Application.DisplayAlerts = True
End If
End Sub
Wat gaat hier mis?