update Generic Master bas6
This commit is contained in:
@@ -178,24 +178,21 @@ Sub SortDataRows(Optional ByVal sortColumn As Long = 3)
|
||||
Header:=xlNo
|
||||
End Sub
|
||||
|
||||
Sub ToggleAutoFilter(Optional ByVal filterRow As Long = 6)
|
||||
Dim ws As Worksheet
|
||||
Set ws = ActiveSheet
|
||||
Sub ToggleAutoFilter(ByVal startColumn As Long, ByVal endColumn As Long, Optional ByVal filterRow As Long = 6)
|
||||
Dim ws As Worksheet: Set ws = ActiveSheet
|
||||
|
||||
' Check if auto filter is already on
|
||||
If ws.AutoFilterMode Then
|
||||
ws.AutoFilterMode = False
|
||||
Else
|
||||
If filterRow >= 1 Then
|
||||
ws.Rows(filterRow).AutoFilter
|
||||
End If
|
||||
Exit Sub
|
||||
End If
|
||||
If startColumn < 1 Or endColumn < startColumn Then Exit Sub
|
||||
Dim filterRange As Range: Set filterRange = ws.Range(ws.Cells(filterRow, startColumn), ws.Cells(filterRow, endColumn))
|
||||
filterRange.AutoFilter
|
||||
End Sub
|
||||
|
||||
Sub AutoFitColumnWidth(Optional ByVal fitColumnStart As Long = 2, Optional ByVal fitColumnEnd As Long = 9)
|
||||
Dim ws As Worksheet
|
||||
Set ws = ActiveSheet
|
||||
|
||||
Sub AutoFitColumnWidth(ByVal fitColumnStart As Long, ByVal fitColumnEnd As Long)
|
||||
Dim ws As Worksheet: Set ws = ActiveSheet
|
||||
If fitColumnStart <= fitColumnEnd Then
|
||||
ws.Range(ws.Columns(fitColumnStart), ws.Columns(fitColumnEnd)).AutoFit
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user