Skip to content

Instantly share code, notes, and snippets.

@cainhill
Created January 24, 2017 06:04
Show Gist options
  • Save cainhill/22b8424cfe1b4460866258bce6f097bc to your computer and use it in GitHub Desktop.
Save cainhill/22b8424cfe1b4460866258bce6f097bc to your computer and use it in GitHub Desktop.
Sub Zap()
Dim CurrentSheet As Worksheet
Dim FieldRow As Range
For Each CurrentSheet In ActiveWorkbook.Sheets
CurrentSheet.Activate
Set FieldRow = CurrentSheet.Columns(1).Find("Fields")
ApplySensibleDefaults FieldRow
Next
End Sub
Sub ApplySensibleDefaults(FieldRow As Range)
Dim Comments As Range
If Not FieldRow Is Nothing Then
' Apply an AutoFilter
Rows(FieldRow.Row).Select
Selection.AutoFilter
' Apply a freeze to the field headings
Rows(FieldRow.Offset(1, 0).Row).Select
ActiveWindow.FreezePanes = True
' Select the first usable content row
FieldRow.Offset(1, 0).Select
' Select all Comments fields in the first column
Columns("A:A").SpecialCells(xlCellTypeComments).Select
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment