I'm havin a problem with the following macro, which works standalone, but not when assigned to a button:
I immediately get the 1004 run-time error. If I change .Select to .Copy and remove the Selection.Copy below, it appears to work since I see the data flash up, then dissappear and it stops on cell A1
Can someone please take a look and see where I'm messing up?
Thanks
Code:
Private Sub CommandButton1_Click()
'Combine Columns
'This macro will clear the contents of column A in "Final", then
'copy the values from "Misc" column A to "Final" column A, and then
'append the values in "Output" column A to the bottom of that list in "Final" column A
Worksheets("Final").Select 'The sheet where you want the results
Range("A:A").ClearContents
Worksheets("Misc").Select 'The sheet where first column data is
[COLOR=#ff0000]Range("A1:" & Range("A65536").End(xlUp).Address).Select[/COLOR]
Selection.Copy
Worksheets("Final").Select 'Go back to paste the data
Range("A1").Select
ActiveSheet.Paste
Worksheets("Output").Select 'the sheet where second column data is
Range("A1:" & Range("A65536").End(xlUp).Address).Select
Selection.Copy
Worksheets("Final").Select 'go back to paste the data
Range("A65536").End(xlUp).Select
Selection.Offset(1, 0).Select
ActiveSheet.Paste
Range("A1").Select
Columns("A:A").ColumnWidth = 27
End Sub
Can someone please take a look and see where I'm messing up?
Thanks