This code assigned to a button does the task.
Private Sub cmdViewOptions_Click()
'toggle views between
' (1) set all data row heights to 15 and hide columns 4-8
' (2) unhide columns 4-8 and automatically set row height for all rows
Dim lastRowNumber As Long
lastRowNumber = Range("A1").End(xlDown).Row
Application.ScreenUpdating = False
If Columns(4).Hidden Then
Columns("D:H").Hidden = False
Rows("2:" & lastRowNumber).Select
Selection.EntireRow.AutoFit
Else
Columns("D:H").Hidden = True
Rows("2:" & lastRowNumber).Select
Selection.RowHeight = 15
End If
Range("A1").Select
Application.ScreenUpdating = True
End Sub
Bookmarks