-
Copy data
Hi all ,
don't know which part by the code below since it was moved from excel 2003 to excel 2007,
Error is
Run Time Error "1004":
excel can't insert the sheets into the destination workbook, because it contains fewer rows and columns than the source workbook .........else.
part of error code here:
.Sheets(1).Copy After:=thisWorkbook.Sheets(thisWorkbook.Sheets.Count)
[VBA]Sub ImportAll()
Dim folderPath As String
Dim fileName As String
Dim thisWorkbook As Workbook
folderPath = "D:\My Documents\Sample\"
Set thisWorkbook = ActiveWorkbook
If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
fileName = Dir(folderPath & "*.xl*")
Do While fileName <> ""
Workbooks.Open folderPath & fileName
With ActiveWorkbook
.Sheets(1).Copy After:=thisWorkbook.Sheets(thisWorkbook.Sheets.Count)
.Close savechanges:=False
End With
fileName = Dir
Loop
MsgBox "Finished"
Sheets("RunData").Select
End Sub[/VBA]
any one can help or advised
thanks
-
Sounds like you are trying to copy a sheet from 2007 to a sheet in 2003 format. Change your xls to an xlsx or xlsm by Save As, close, and reopen to get the maximum number of rows allowed by 2007.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules