Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copying to external workbook


Hi Guys still battling!

Have read threads but can't get this code to work.
WHat I need to accomplish is to copy the contents of Test.XLS sheet1
to Z:\July.xls sheet1 (THis sheet will be closed)

Just can't get it to work Please help.

Here is my code:

Private Sub CommandButton7_Click()

Dim wbk As Workbook
Dim wks As Worksheet
Dim SrcBook As Workbook


Set SrcBook = Active.Workbooks


Set wbk = Workbooks.Open("I:\July.xls")
Set wks = wbk.Sheet1


Application.ScreenUpdating = False

SrcBook.Sheets("Sheet1").UsedRange.Copy _
wbk:=wbk.Sheets _
("Sheet1").Range("A1")

SrcBook.Close (False)

Application.ScreenUpdating = True

End Sub


Thx in advance


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=389659

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default copying to external workbook

Hi Mikeice,

Try:

Private Sub CommandButton7_Click()

Dim wbk As Workbook
Dim wks As Worksheet
Dim SrcBook As Workbook


Set SrcBook = ActiveWorkbook


Set wbk = Workbooks.Open("I:\July.xls")
Set wks = wbk.Sheets("Sheet1")


Application.ScreenUpdating = False

SrcBook.Sheets("Sheet1").UsedRange.Copy Destination:= _
wks.Range("A1")

SrcBook.Close (False)

Application.ScreenUpdating = True

End Sub
---
Regards,
Norman



"Mikeice" wrote in
message ...

Hi Guys still battling!

Have read threads but can't get this code to work.
WHat I need to accomplish is to copy the contents of Test.XLS sheet1
to Z:\July.xls sheet1 (THis sheet will be closed)

Just can't get it to work Please help.

Here is my code:

Private Sub CommandButton7_Click()

Dim wbk As Workbook
Dim wks As Worksheet
Dim SrcBook As Workbook


Set SrcBook = Active.Workbooks


Set wbk = Workbooks.Open("I:\July.xls")
Set wks = wbk.Sheet1


Application.ScreenUpdating = False

SrcBook.Sheets("Sheet1").UsedRange.Copy _
wbk:=wbk.Sheets _
("Sheet1").Range("A1")

SrcBook.Close (False)

Application.ScreenUpdating = True

End Sub


Thx in advance


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile:
http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=389659



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
copying workbook formating to a differnent workbook Roger Excel Worksheet Functions 0 October 30th 09 05:27 PM
macros for copying external data to Excel Bradly Excel Discussion (Misc queries) 2 April 6th 09 03:22 AM
Copying Excel 2007 data to external programs Cindy Excel Discussion (Misc queries) 3 October 27th 08 03:57 PM
Copying cell values to a external file in VBA DJ MC Excel Discussion (Misc queries) 6 September 29th 06 09:07 AM
Copying data to an external Program Debby Bunce New Users to Excel 1 June 9th 05 12:31 AM


All times are GMT +1. The time now is 05:51 AM.

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

About Us

"It's about Microsoft Excel"