Hi All,
Having a head scratcher have the below macro and it works every other time! fill in the table press button and fails (debug points to Paste special line). after which i change nothing in the code and press button again runs fine! its almost like its losing the data from the clipbord? any help would be brilliant thanks again all!
Having a head scratcher have the below macro and it works every other time! fill in the table press button and fails (debug points to Paste special line). after which i change nothing in the code and press button again runs fine! its almost like its losing the data from the clipbord? any help would be brilliant thanks again all!
Code:
Sub Macro1()
'
' Macro1 Macro
'
Sheets("Input").Select
lastCol = ActiveSheet.Range("a2").End(xlToRight).Column
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a2", ActiveSheet.Cells(lastRow, lastCol)).Select
Selection.Copy
Sheets("Data").Select
ActiveSheet.Unprotect
Range("G1").Select
Range("G1").End(xlDown).Select
ActiveCell.Offset(1, -6).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Input").Select
Range("A2:F20").Select
Selection.ClearContents
Range("h2:j20").Select
Selection.ClearContents
ActiveWorkbook.Save
'
End Sub