Hi,
You guys were so helpful last time, I thought I'd try this again. So I have a form button that runs some macros and when I click it once, all is well and it does what I told it to. If I click it a second time I get the Run Time error 1004 PasteSpecial method of range class failed. So I press debug - literally do nothing, just close out of VB, then click the button again and it works - but same error the second time. How can this be?
I know the code is pretty basic, but I'm not very good at this. I'm really just trying to understand how it can work once, but give an error the second time, then not actually need fixing then work again!?
Thanks,
K
You guys were so helpful last time, I thought I'd try this again. So I have a form button that runs some macros and when I click it once, all is well and it does what I told it to. If I click it a second time I get the Run Time error 1004 PasteSpecial method of range class failed. So I press debug - literally do nothing, just close out of VB, then click the button again and it works - but same error the second time. How can this be?
Code:
Range("Rationale").Select
Selection.Copy
Workbooks("job evaluation Database for TP.xls").Activate
Sheets("Paste Sheet Here").Visible = True
Sheets("Paste Sheet Here").Select
Range("A1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("B4:B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Database").Unprotect
Sheets("Database").Activate
Range("A1").Activate
ActiveCell.End(xlDown).Activate
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Paste Sheet Here").Select
Range("E12:E44").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Database").Select
Range("F1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Paste Sheet Here").Select
Range("F2:F9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Database").Select
Range("AM1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Paste Sheet Here").Select
Range("A1:G44").Select
Application.CutCopyMode = False
Selection.ClearContents
Selection.ClearFormats
Range("A1").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Database").Select
Range("A1").Select
Sheets("Database").Protect
I know the code is pretty basic, but I'm not very good at this. I'm really just trying to understand how it can work once, but give an error the second time, then not actually need fixing then work again!?
Thanks,
K