dannieshelp
Gebruiker
- Lid geworden
- 29 jun 2008
- Berichten
- 16
Hallo,
Ik gebruik de onderstaande code om data die aan een bepaalde voorwaarde voldoet vanuit een werkblad te copieren naar een archief.
Nu krijg ik telkens een runtime error 1004. Ik kom er niet uit. kan iemand mij vertellen wat ik moet doen?
De code is als volgt:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Blad2.Unprotect
Blad5.Unprotect
With Worksheets("Formulation Active").Range("A5:A100")
Do
Set A = .Find("Complete", LookIn:=xlValues, SearchDirection:=xlNext)
If Not A Is Nothing Then
B = A.Row
Rows(B).Copy
Worksheets("Formulation Archive").Select
With Worksheets("Formulation Archive").Range("A5:A10000")
Set Z = .Find("", LookIn:=xlValues)
If Not Z Is Nothing Then
Z = Z.Row
Worksheets("Formulation Archive").Range("A" & CStr(Z)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
End With
Worksheets("Formulation Active").Select
Rows(B).Select
Selection.Delete
End If
Loop Until A Is Nothing
End With
Blad2.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True _
, AllowFiltering:=True, AllowInsertingHyperlinks:=True
Blad5.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Application.ScreenUpdating = True
End Sub
Alvast bedankt voor de hulp.
Groeten,
Danny
Ik gebruik de onderstaande code om data die aan een bepaalde voorwaarde voldoet vanuit een werkblad te copieren naar een archief.
Nu krijg ik telkens een runtime error 1004. Ik kom er niet uit. kan iemand mij vertellen wat ik moet doen?
De code is als volgt:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Blad2.Unprotect
Blad5.Unprotect
With Worksheets("Formulation Active").Range("A5:A100")
Do
Set A = .Find("Complete", LookIn:=xlValues, SearchDirection:=xlNext)
If Not A Is Nothing Then
B = A.Row
Rows(B).Copy
Worksheets("Formulation Archive").Select
With Worksheets("Formulation Archive").Range("A5:A10000")
Set Z = .Find("", LookIn:=xlValues)
If Not Z Is Nothing Then
Z = Z.Row
Worksheets("Formulation Archive").Range("A" & CStr(Z)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
End With
Worksheets("Formulation Active").Select
Rows(B).Select
Selection.Delete
End If
Loop Until A Is Nothing
End With
Blad2.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True _
, AllowFiltering:=True, AllowInsertingHyperlinks:=True
Blad5.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Application.ScreenUpdating = True
End Sub
Alvast bedankt voor de hulp.
Groeten,
Danny