Jon,
Thank you. That worked perfectly.
Andy
"Jon Peltier" wrote:
Try something like
GridSheet.UsedRange.EntireColumn.AutoFit
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______
"Andy_WS" wrote in message
...
We had Office 2003 installed and we ran a VBscript that would auto create
workbooks depending on the data retrieved. At the bottom of the script we
used this statement:
GridSheet.Columns("A:ZZ").AutoFit ' Prettyprint
We recently upgraded to Office 2007 and the script returned a mismatch
error
when trying to AutoFit the columns. We modified the statment to this:
GridSheet.Columns("A:IV").AutoFit ' Prettyprint
If the Columns range is changed to ("A:IW") it will return a "Type
mismatch
error" again. There seems to be a limit now?
Does anyone know what has changed from 2003 to 2007 that would cause this
to
happen or does anyone know of a better way to use this statement?
Basically we want the script to AutoFit all columns contained in the
worksheet.
Thank You for your help in advance
Andy