I hope you understand the problem Here is the code.
What is wrong. THX
Sub Macro2()
Dim st As String
Dim irow As Long
Workbooks.Open Filename:="C:\Tmp\Dossier.xlsm"
Sheets("Blad1").Activate
Sheets("Blad1").Unprotect Password = "1141"
Sheets("Blad1").Range("A" & Rows.Count).End(xlUp).Offset(1).Activate
Sheets("Blad1").Range("A" & Rows.Count).End(xlUp).Offset(1).Select
' use of this macro a second time it gives an error on next instruction
' but whitout the protect and unprotect it works fine
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Blad1").Protect Password = "1141", userinterfaceonly:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
What is wrong. THX
Sub Macro2()
Dim st As String
Dim irow As Long
Workbooks.Open Filename:="C:\Tmp\Dossier.xlsm"
Sheets("Blad1").Activate
Sheets("Blad1").Unprotect Password = "1141"
Sheets("Blad1").Range("A" & Rows.Count).End(xlUp).Offset(1).Activate
Sheets("Blad1").Range("A" & Rows.Count).End(xlUp).Offset(1).Select
' use of this macro a second time it gives an error on next instruction
' but whitout the protect and unprotect it works fine
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Blad1").Protect Password = "1141", userinterfaceonly:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub