recorded macro code:
Range("A2".Select
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
My code:
Sub Calstars()
Dim myRange As Range
Worksheets("CalstarsReport".Range("Calstars".Copy
Workbooks.Add (xlWBATWorksheet)
With Workbooks(2).Worksheets(1)
.Cells(.UsedRange.Cells(.UsedRange.Cells.Count).Row + 1, 1).PasteSpecial xlValues
End With
Workbooks(2).Worksheets(1).UsedRange.PasteSpecial xlFormats
Range("A2".Select
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
My code dies w/
runtime error "1004"/Application defined or object defined error
on the last line of code where I tell it to paste special. I can manually go to cell a2 and pastespecial/columnwidths and it works fine.
Please advise.
Thank you
Range("A2".Select
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
My code:
Sub Calstars()
Dim myRange As Range
Worksheets("CalstarsReport".Range("Calstars".Copy
Workbooks.Add (xlWBATWorksheet)
With Workbooks(2).Worksheets(1)
.Cells(.UsedRange.Cells(.UsedRange.Cells.Count).Row + 1, 1).PasteSpecial xlValues
End With
Workbooks(2).Worksheets(1).UsedRange.PasteSpecial xlFormats
Range("A2".Select
Selection.PasteSpecial Paste:=xlColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
My code dies w/
runtime error "1004"/Application defined or object defined error
on the last line of code where I tell it to paste special. I can manually go to cell a2 and pastespecial/columnwidths and it works fine.
Please advise.
Thank you