View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Oldjay Oldjay is offline
external usenet poster
 
Posts: 337
Default Command button failure

Why does the following fail @ Range("D2").Select

Rum-time error '1004"
Application-defined or object-defined error

If I run the exact same code in a Macro it works fine

Private Sub CommandButton1_Click()

Workbooks.Add
ActiveWorkbook.SaveAs Filename:="TempData.xls"
Windows("testbook.XLS").Activate
Range("D2:D7").Select
Selection.Copy
Windows("TempData.XLS").Activate
Range("D2").Select
ActiveSheet.Paste

End Sub