I think the error occurs when it is past into my sheet.

Is there anyone who can help me with this script?

-

Const dbSti = "C:\Documents and Settings\Bruger\Skrivebord\Opgaver\Fejlmelding\Database"

Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim LR As Long, i As Long

LR = Range("A" & Rows.Count).End(xlUp).Row

'open database file
Workbooks.Open Filename:=dbSti & "\" & "database.xlsm"

Set ws = Worksheets("Prio2")


Application.ScreenUpdating = False


For i = 2 To LR
With ws.Range("A" & i)
If .Value <> "" Then .EntireRow.Cut Destination:=ws.Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
Next i
On Error Resume Next
Sheets("prio1").Range("B2:B" & LR).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0

ActiveWorkbook.Save
ActiveWorkbook.Close

Application.ScreenUpdating = True

Unload Me

End Sub

-

How can I past it after i closed the workbook, where im cutting it from?!

Best regards
Jesper Vejby