View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme[_2_] Bernard Liengme[_2_] is offline
external usenet poster
 
Posts: 563
Default How do I write an array to include all worksheets in a workbook?

Just out of interest, why did you suggest making this a sheet subroutine
rather than putting it in a general module?
best wsihes

--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Mike H" wrote in message
...
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