Works in 2000, not in 2007

C

CLR

Hi All.....
I have a program that opens a second file and then copies a sheet out of it
into the main program. It was written in XL2000 and works fine. When I try
to run it in XL2007 it stops on the following line:

ActiveSheet.Copy after:=ThiisWorkbook.sheets(1)

And gives the following error message:

"Excel cannot insert the sheets into the destination workbook, because it
contains fewer rows and columns than the source workbook. To move or copy
the data to the destination workbook, you can select the data, and then use
the Copy and paste commands to insert it into the sheets of another workbook."

The sheet I'm trying to copy is only 450 rows and about 15 columns, and
copies fine in XL2000.

Any ideas would be appreciated.

Vaya con Dios,
Chuck CABGx3
 
F

fisch4bill

Try inserting a blank sheet first and then pasting your data into the empty
sheet - two steps rather than just the one.
 
B

Barb Reinhardt

I'm just guessing that your ActiveSheet is in Excel 2000 form (max rows
65536, max cols 256) and ThisWorkbook is in Excel 2007 form with more rows
and columns (I don't know the max of the top of my head.

I'm thinking that if the workbook with your active sheet in it was saved as
a .xlsx file and then you tried to do this, it would work.

Does this code need to be used in both 2000 and 2007?
 
C

CLR

Thanks Barb, that did the trick.
I opened the .xls workbook in XL2007 and saved it right away as a .xlsm file
and then closed it and re-opened it in XL2007 and ran the macros and all went
fine......dunno why, but it just did. I much appreciate your suggestion.

Yes, to answer your question, it needs to run in both XL2007 and XL2000 for
the time being because we have a LOT of computers here and some of the Users
use XL2000 and some use XL2007 (and actually all the other versions also),
and it's a lot nicer for me if just the one program will run on both and I
don't have to keep track of who gets what version when........will probably
have to get in to that someday soon tho.

Vaya con Dios,
Chuck, CABGx3
 
C

CLR

Thanks for responding, but Barb's recommendation did the trick for me this
time.

Vaya con Dios,
Chuck, CABGx3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top