LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copy/Paste Special from Many Files

I've got 500 workbooks, all formatted the same. I want to copy 2
columns from each of the workbooks to a new workbook. I'm not sure I
can have 1000 columns in Excel, but I can split the process into
groups. Anyway, I was testing my code with a couple of files and it's
not working. What I end up with is an empty worksheet. Also. must
past special to get just the values, because the workbooks all have
formulas in them. I've never done this particular bit before. Not
sure how it should work. Could someone take a look and help me out
with a suggestion or 3?

Thanks,
Jennifer

Sub MoveCols()
Dim XL As Excel.Application
Dim fso
Dim fol
Dim Col1 As Integer
Dim Col2 As Integer
Dim fil
Dim Unit As String
Set XL = New Excel.Application
Set fso = CreateObject("scripting.Filesystemobject")
Col1 = 2
Col2 = 3
Set fol = fso.getfolder("C:\Out\Audits\Test")


For Each fil In fol.Files
XL.Workbooks.Open (fil.Path)
Unit = Mid(fil.Path, InStr(1, fil.Path, ".") + 1)
XL.Worksheets("Final Plan").Columns("S:T").Select
Selection.Copy
Range(Columns(Col1), Columns(Col2)).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Col1 = Col1 + 2
Col2 = Col2 + 2
Worksheets("Sheet1").Cells(9, Col1).Value = Unit
XL.Quit
Next

End Sub

 
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
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Copy & paste special Roger Excel Worksheet Functions 2 February 9th 06 12:26 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 04:33 AM.

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"