Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Problem With A Pesky Question during a Macro

When running the below macro I get a dialog box asking if I want to keep &
use the data on the clipboard, which of course I do since I am pasting it
just a few lines down.
How can I keep this from happening?

Sub CopyTable

Windows("table.csv").Activate
Range("A1:G486").Select
Selection.Copy
ActiveWorkbook.Close
Range("W6").Select
ActiveSheet.Paste

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Problem With A Pesky Question during a Macro

After the copy, activate the "other" workbook and do the paste. Then close
"table.csv"
--
Gary''s Student - gsnu200855


"Paul" wrote:

When running the below macro I get a dialog box asking if I want to keep &
use the data on the clipboard, which of course I do since I am pasting it
just a few lines down.
How can I keep this from happening?

Sub CopyTable

Windows("table.csv").Activate
Range("A1:G486").Select
Selection.Copy
ActiveWorkbook.Close
Range("W6").Select
ActiveSheet.Paste

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Problem With A Pesky Question during a Macro

Sub copyToBk2nClose()

Dim copyFrom As Range, copyTo As Range
Dim wksCopyTo As Worksheet
Set ThisWB = ActiveWorkbook
Set copyFrom = ThisWorkbook.Sheets("yourSheet").Range("A1:G486")
'change yourSheet
Set wksCopyTo = Workbooks("Book2.xls").Sheets("Sheet1")
'change Book2 and Sheet1
Set copyTo = wksCopyTo.Range("W6")
copyFrom.Copy
wksCopyTo.Paste copyTo
Application.CutCopyMode = False
ThisWorkBook.Close
End Sub

--
Steve

"Paul" wrote in message
...
When running the below macro I get a dialog box asking if I want to keep &
use the data on the clipboard, which of course I do since I am pasting it
just a few lines down.
How can I keep this from happening?

Sub CopyTable

Windows("table.csv").Activate
Range("A1:G486").Select
Selection.Copy
ActiveWorkbook.Close
Range("W6").Select
ActiveSheet.Paste

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Problem With A Pesky Question during a Macro

don't activate the table.csv workbook

Sub CopyTable

Windows("table.csv").Range("A1:G486").Copy
Range("W6").Paste
Application.CutCopyMode = False
workbooks("table.csv").Close False

End Sub



"Paul" wrote in message
...
When running the below macro I get a dialog box asking if I want to keep &
use the data on the clipboard, which of course I do since I am pasting it
just a few lines down.
How can I keep this from happening?

Sub Ctable.csvopyTable

Windows("").Activate
Range("A1:G486").Select
Selection.Copy
ActiveWorkbook.Close
Range("W6").Select
ActiveSheet.Paste

End Sub


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
Pesky spaces Richard Excel Discussion (Misc queries) 1 February 7th 08 06:53 PM
Pesky VLookup !!! Lacklustre Excel Worksheet Functions 4 February 24th 05 04:51 AM
Pesky little problem with no solution? Bony Pony Excel Worksheet Functions 5 February 2nd 05 03:15 PM
Pesky Autofilter Toggle Digory Excel Programming 4 November 14th 04 03:06 PM
Pesky Ckeckboxes ! Neil Excel Programming 0 September 10th 03 04:06 PM


All times are GMT +1. The time now is 11:00 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"