Mr Retirement
New Member
- Joined
- Nov 12, 2016
- Messages
- 46
Hi All -
I have a code below that works as intended, but I need help changing it slightly.
It currently works to cycle through all worksheets and adjust the column widths from the active sheet.
The change I need is: I want 2 worksheets to be exempt from this editing. The 2 sheets are called "Vis" & "Staff"
Any help would be appreciated!!
Thanks guys!
I have a code below that works as intended, but I need help changing it slightly.
It currently works to cycle through all worksheets and adjust the column widths from the active sheet.
The change I need is: I want 2 worksheets to be exempt from this editing. The 2 sheets are called "Vis" & "Staff"
Any help would be appreciated!!
Code:
Sub CopyColumnWidths()
On Error GoTo EndIt
Dim wActSht As Worksheet
Dim arrWidths(101) As Single
Set wActSht = ActiveSheet
For x = 3 To 104
arrWidths(x - 3) = wActSht.Cells(1, x).ColumnWidth
Next
For Each sht In Sheets
If sht.Name <> wActSht.Name Then
For x = 3 To 104
sht.Cells(1, x).ColumnWidth = arrWidths(x - 3)
Next
End If
Next
EndIt:
End Sub
Thanks guys!