LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
lcannon
 
Posts: n/a
Default Copy Paste Question


I am new with VBA - is the code below copying from Test1 and Test2 to
paste into current spreadsheet??


Why am I getting an error on this line form the code below.




Workbooks.Open Filename:=ar(i)


It seems not to see the files I am trying to open????

__________________________________________________ ___


Sub macro2()
'


Dim present_workbook As String
Dim ar As Variant
ar = Array("D:\Documents and Settings\My Documents\test1.xls ", "
D:\Documents and Settings\My Documents\test2.xls ") ' all the spread
sheets
present_workbook = ActiveWorkbook.Name
For i = 0 To UBound(ar)
Workbooks.Open Filename:=ar(i)
temp = ActiveWorkbook.Name
Range("A1:G1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.End(xlDown).Select
If (ActiveCell.Row < 65536) Then
Range("A1:G1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks(present_workbook).Activate
Sheets("Sheet1").Select
Range("A65535").Select
Selection.End(xlUp).Select
If (ActiveCell.Row < 1) Then
ActiveCell.Offset(1, 0).Select
End If
ActiveSheet.Paste
Application.CutCopyMode = False

End If
Workbooks(temp).Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
Next
End Sub


--
lcannon
------------------------------------------------------------------------
lcannon's Profile: http://www.excelforum.com/member.php...o&userid=24253
View this thread: http://www.excelforum.com/showthread...hreadid=378648

 
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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM
link data to new workbook WYN Excel Discussion (Misc queries) 3 February 28th 05 06:19 AM
Copy & Paste Brian Keanie Excel Discussion (Misc queries) 1 February 5th 05 11:56 AM


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