View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How do I write an array to include all worksheets in a workbook?

hi,

Right click any of your sheet tab, view code and paste this code in and run it

Sub sonic()
For x = 1 To Worksheets.Count
Sheets(x).Columns("A:H").AutoFit
Next
End Sub

Mike

"Jodie" wrote:

I am trying to add to a marco to auto fit columns A through H in all
worksheets. How would I add this so it does not matter how many tabs are in
the workbook as it will continually change?
--
Thank you, Jodie