|
-
Jul 18th, 2003, 09:38 PM
#2
New Member
Hi there
Try this simple example. I think it should work for any workbook if you modify the code a bit. Instead of using the Index of the workbook, in the line For Each shtWorkSheet In Workbooks(1).Worksheets, you can use the active workbook, or a workbook by name, or what have you.
Also you may change the 25 in the line .Columns.ColumnWidth = 25 to what ever width you want.
Sub ChangeColumnWidthInAllWorksheets()
Dim shtWorkSheet As Worksheet '/A Counter for all the Worksheets.
'/Loop using each of the worksheets in the workbook.
For Each shtWorkSheet In Workbooks(1).Worksheets
'/With the object which is the worksheets
With shtWorkSheet
'/And the worksheet has columns so with these, change the widht to 25
.Columns.ColumnWidth = 25
End With
'/Loop to the Next worksheet.
Next shtWorkSheet
'/Beep when done.
Beep
End Sub
Let me know if you need any help.
Dr. Technology
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|