The information in this article applies to:
SYMPTOMSIn Microsoft Excel 5.0, when you record a macro that includes the AutoFit Selection command, the resulting macro will apply the AutoFit command to the entire row or column rather than to the desired selection. CAUSEThis behavior occurs when you record the macro using the Visual Basic language. The recorded Visual Basic code uses the EntireColumn property to qualify the AutoFit method. For example, if you are using the macro recorder, and you select a cell, and use the column AutoFit feature, the following command is recorded:
WORKAROUNDTo work around this behavior, you can modify the recorded command, or add the following command to your Visual Basic procedure to perform an AutoFit on the current selection instead of the entire column.
To perform the AutoFit on a row rather than a column, use the Rows method
instead of the Columns method as in the following example:
Microsoft provides examples of Visual Basic procedures for
illustration only, without warranty either expressed or implied,
including but not limited to the implied warranties of merchantability
and/or fitness for a particular purpose. This Visual Basic procedure
is provided 'as is' and Microsoft does not guarantee that it can be
used in all situations. Microsoft does not support modifications of
this procedure to suit customer requirements for a particular purpose.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c. Additional query words: auto-fit
Keywords : kbprg |
Last Reviewed: October 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |