I have been getting a 1004 error, as if it doesn't have anything copied. But if I open just a blank excel sheet and manually click CTRL-V it works and pastes it in.
Here is the copy code and the paste code, the line causing the error is highlighted in purple.
Both workbooks I am trying to copy and paste to are identical. Both are open just named 123_old and 678_new. They click copy and it copies the db page and that works, you then click on the paste button the new workbook, put in your password and it throws a "Run time error 1004" "Pastespecial method of range class failed".
ANY HELP OR IDEAS ARE WELCOME. I am stuck on this.
Sub Copy_data()
101:
Application.ScreenUpdating = False
Sheets("Setup").Visible = True
answer = MsgBox("Click YES to copy this sheets entire db page." & vbCrLf & "This will not delete this sheets db information." & vbCrLf & "Click YES to Continue." & vbCrLf & "Click NO to cancel.", vbQuestion + vbCritical + vbYesNo, "DB PAGE ENTRY COPY")
If answer = vbYes Then
x = InputBox("Enter your Password.", "Password Required")
If x = "123456" Then
Worksheets("db").Unprotect Password:="123456"
Worksheets("db").Range("A3:DS50000").Copy
'Worksheets("db").Protect Password:="123456"
Else
If i <= 1 Then
MsgBox "Invalid Password. Try again"
i = i + 3
GoTo 101:
Else
MsgBox "Incorrect password entered too many times. Try again later."
Exit Sub
End If
End If
End If
Application.ScreenUpdating = True
End Sub
Sub Paste_data()
101:
Application.ScreenUpdating = False
Sheets("Setup").Visible = True
answer = MsgBox("Click YES to paste all information copied" & vbCrLf & "from the other db page." & vbCrLf & "This will overwrite the current information in this db page." & vbCrLf & "Click YES to Continue." & vbCrLf & "Click NO to cancel.", vbQuestion + vbCritical + vbYesNo, "DB PAGE ENTRY PASTE")
If answer = vbYes Then
x = InputBox("Enter your Password.", "Password Required")
If x = "123456" Then
Worksheets("db").Unprotect Password:="123456"
Worksheets("db").Range("A3:DS50000").PasteSpecial
Worksheets("db").Protect Password:="123456"
Else
If i <= 1 Then
MsgBox "Invalid Password. Try again"
i = i + 3
GoTo 101:
Else
MsgBox "Incorrect password entered too many times. Try again later."
Exit Sub
End If
End If
End If
Application.ScreenUpdating = True
End Sub
Here is the copy code and the paste code, the line causing the error is highlighted in purple.
Both workbooks I am trying to copy and paste to are identical. Both are open just named 123_old and 678_new. They click copy and it copies the db page and that works, you then click on the paste button the new workbook, put in your password and it throws a "Run time error 1004" "Pastespecial method of range class failed".
ANY HELP OR IDEAS ARE WELCOME. I am stuck on this.
Sub Copy_data()
101:
Application.ScreenUpdating = False
Sheets("Setup").Visible = True
answer = MsgBox("Click YES to copy this sheets entire db page." & vbCrLf & "This will not delete this sheets db information." & vbCrLf & "Click YES to Continue." & vbCrLf & "Click NO to cancel.", vbQuestion + vbCritical + vbYesNo, "DB PAGE ENTRY COPY")
If answer = vbYes Then
x = InputBox("Enter your Password.", "Password Required")
If x = "123456" Then
Worksheets("db").Unprotect Password:="123456"
Worksheets("db").Range("A3:DS50000").Copy
'Worksheets("db").Protect Password:="123456"
Else
If i <= 1 Then
MsgBox "Invalid Password. Try again"
i = i + 3
GoTo 101:
Else
MsgBox "Incorrect password entered too many times. Try again later."
Exit Sub
End If
End If
End If
Application.ScreenUpdating = True
End Sub
Sub Paste_data()
101:
Application.ScreenUpdating = False
Sheets("Setup").Visible = True
answer = MsgBox("Click YES to paste all information copied" & vbCrLf & "from the other db page." & vbCrLf & "This will overwrite the current information in this db page." & vbCrLf & "Click YES to Continue." & vbCrLf & "Click NO to cancel.", vbQuestion + vbCritical + vbYesNo, "DB PAGE ENTRY PASTE")
If answer = vbYes Then
x = InputBox("Enter your Password.", "Password Required")
If x = "123456" Then
Worksheets("db").Unprotect Password:="123456"
Worksheets("db").Range("A3:DS50000").PasteSpecial
Worksheets("db").Protect Password:="123456"
Else
If i <= 1 Then
MsgBox "Invalid Password. Try again"
i = i + 3
GoTo 101:
Else
MsgBox "Incorrect password entered too many times. Try again later."
Exit Sub
End If
End If
End If
Application.ScreenUpdating = True
End Sub