ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple copy paste question (https://www.excelbanter.com/excel-programming/290425-simple-copy-paste-question.html)

Z[_2_]

Simple copy paste question
 
Hello!

I am developing a macro that begins by opening a .csv, copying all of
the data, pasting it into a worksheet, then closing the .csv file.
The problem is that it always prompts the user that there is a large
amount of data on the clipboard, etc. etc.

How can I make this message fail to appear so that the macro will run
without user intervention?

Thanks!
Z

Ed[_9_]

Simple copy paste question
 
Application.DisplayAlerts = False. Don't forget to reset to True when
you're done.

Ed

"Z" wrote in message
om...
Hello!

I am developing a macro that begins by opening a .csv, copying all of
the data, pasting it into a worksheet, then closing the .csv file.
The problem is that it always prompts the user that there is a large
amount of data on the clipboard, etc. etc.

How can I make this message fail to appear so that the macro will run
without user intervention?

Thanks!
Z




Ron de Bruin

Simple copy paste question
 
Hi

You can use this (copy/paste in one line)

Sub test()
Dim WB As Workbook
Dim Mybook As Workbook
Application.ScreenUpdating = False
Set Mybook = ThisWorkbook
Set WB = Workbooks.Open("C:\Book.csv")
WB.Sheets(1).UsedRange.Copy Mybook.Sheets(1).Cells(1)
WB.Close False
Application.ScreenUpdating = True
End Sub


Or this after your paste line
Application.CutCopyMode = False

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Z" wrote in message om...
Hello!

I am developing a macro that begins by opening a .csv, copying all of
the data, pasting it into a worksheet, then closing the .csv file.
The problem is that it always prompts the user that there is a large
amount of data on the clipboard, etc. etc.

How can I make this message fail to appear so that the macro will run
without user intervention?

Thanks!
Z




Gord Dibben

Simple copy paste question
 
Application.CutCopyMode = False

Place this line at end of your macro code.

Gord Dibben Excel MVP

On 5 Feb 2004 12:05:54 -0800, (Z) wrote:

Hello!

I am developing a macro that begins by opening a .csv, copying all of
the data, pasting it into a worksheet, then closing the .csv file.
The problem is that it always prompts the user that there is a large
amount of data on the clipboard, etc. etc.

How can I make this message fail to appear so that the macro will run
without user intervention?

Thanks!
Z




All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com