Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Cut and Paste Macro.

So I'm having an inputbox pop-up so I can have the data from that sheet
cut and pasted into the new sheet. It all seems to work, but the paste
portion always errors out. Any ideas what I'm doing wrong?

Thanks!

Workbooks.Open Filename:=strFile
Selection.CurrentRegion.Select
Selection.Copy
ActiveWindow.Close
Worksheets("All Movements").Select
Range("A1").Select
ActiveSheet.Paste

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Cut and Paste Macro.

I Believe it's because you have closed the workbook with .DisplayAlerts
disabled, which tells excel to blow away the large amounts of information in
the clipboard. Try this order instead:
Dim wb1 As Workbook
Dim wb2 As Workbook
Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open(strFile)
Selection.CurrentRegion.Copy wb1.Worksheets("All Movements").Range("A1")
wb2.Close
--
Charles Chickering

"A good example is twice the value of good advice."


" wrote:

So I'm having an inputbox pop-up so I can have the data from that sheet
cut and pasted into the new sheet. It all seems to work, but the paste
portion always errors out. Any ideas what I'm doing wrong?

Thanks!

Workbooks.Open Filename:=strFile
Selection.CurrentRegion.Select
Selection.Copy
ActiveWindow.Close
Worksheets("All Movements").Select
Range("A1").Select
ActiveSheet.Paste


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Cut and Paste using Macro gives paste special method error Lourens Pentz Excel Programming 3 November 21st 04 10:42 PM
Macro to Paste to specific line, and continue to Paste each time on next row not over tomkarakowski[_2_] Excel Programming 1 May 28th 04 06:50 PM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"