I can't see why you would get the type mismatch error, probably need to see some data for that.
Don't think it's got anything to do with lastCol though.
There are a few other errors in the code that could cause problems.
For example,
here there's no sheet reference for Cells(2,8) and Cells(lastRow, lastCol) so the code will fail unless Sheets(1) is active.
To avoid the problem you can use this.
[/code]
There's a similar error on the last line of the code with a similar solution.
What's the purpose of the code anyway?
Can you upload an example workbook?
Click on GO ADVANCED and use the paperclip icon to open the upload window.
Bookmarks