ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Too Many Cell Formats" when merging files (https://www.excelbanter.com/excel-programming/396539-too-many-cell-formats-when-merging-files.html)

Chad Ginther

"Too Many Cell Formats" when merging files
 
I am having trouble addressing a problem with the dreaded "Too Many Cell
Formats" error, when I exceed the 4000 style limit.

I am merging multiple workbooks together, which all come from the same
template. Thus they all have the same formatting. But when I merge them
together into one book, using the Sheet.Copy command in VBA, I end up running
into too many cell formats. It seems that the number of duplicate styles is
very high. I've tried cleaning up the template to reduce the number of
formats. That helped for a while, until I started adding more sheets, which
multiplied the number of duplicate styles.

Only a handful seem to be named styles, listed on the Styles list as
"Normal_Sheet1", "Normal_Sheet2" and so on. But there are thousands more
cell formats throughout the workbook that I cannot detect.

Is there any better way to copy sheets without bringing all of the styles,
or a way to merge the duplicate styles together as I go along?

[email protected][_2_]

"Too Many Cell Formats" when merging files
 


If the first rows of the two worksheets are headers you could use ADO
and a select statement to merge the two Worksheets.

No formatting to worry about.

Read the thread : "How do you store data in Excel as a database?" for
examples.



All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com