ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   exit from a loop? (https://www.excelbanter.com/excel-programming/316090-re-exit-loop.html)

crispbd[_23_]

exit from a loop?
 

Try this:

Sub AutoFitAllSheets

For Each wksht In ActiveWorkbook.Worksheets
wksht.Activate
wksht.Cells.Select
Selection.EntireColumn.AutoFit
wksht.Range("A1").Select
Next

End Su

--
crispb
-----------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088
View this thread: http://www.excelforum.com/showthread.php?threadid=27639



All times are GMT +1. The time now is 02:47 PM.

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