Prevent Errors due to Filtered lines
Apply this at the beginning of any code where data might be filtered:
If ActiveSheet.AutoFilterMode then
If ActiveSheet.FilterMode then ActiveSheet.ShowAllData
End If
'Filter drop downs will be available but ALL filters will be set to ALL data
If ActiveSheet.AutoFilterMode then
If ActiveSheet.FilterMode then ActiveSheet.ShowAllData
End If
'Filter drop downs will be available but ALL filters will be set to ALL data
Auto Open - Reset Filters
Private Sub Workbook_Open()
Dim iRow As Long
Worksheets("ActivityLog").Select
'Route to code handler based on if there is a filter or not...
'Filter Exists
If ActiveSheet.AutoFilterMode Then GoTo gResetActivityLogFilter
'No Filter (do nothing)
GoTo gActivityLogFilterIsNotTurnedOn
gResetActivityLogFilter:
'MsgBox "pause for station identification"
'Select the cells:
Cells.Select
'Turn the filter Off
Selection.AutoFilter
'Turn the filter On
Selection.AutoFilter
'Go to the last cell on the sheet
ActiveCell.SpecialCells(xlLastCell).Select
iRow = Range(ActiveCell.Address).Row
'Go to Column A on the last cell in the sheet
Cells(iRow, 3).Select
'finished - resume standard code
GoTo gNoActivityLogAutoProcess
gActivityLogFilterIsNotTurnedOn:
'Select the cells:
Cells.Select
'Turn the filter Off
Selection.AutoFilter
'Go to the last cell on the sheet
ActiveCell.SpecialCells(xlLastCell).Select
iRow = Range(ActiveCell.Address).Row
'Go to Column A on the last cell in the sheet
Cells(iRow, 3).Select
'finished - resume standard code
GoTo gNoActivityLogAutoProcess
gNoActivityLogAutoProcess:
'''Debug.Print ActiveWorkbook.ReadOnly
'Only save the workbook if it is NOT "Read Only"
If ActiveWorkbook.ReadOnly = False Then ActiveWorkbook.Save
End Sub
Dim iRow As Long
Worksheets("ActivityLog").Select
'Route to code handler based on if there is a filter or not...
'Filter Exists
If ActiveSheet.AutoFilterMode Then GoTo gResetActivityLogFilter
'No Filter (do nothing)
GoTo gActivityLogFilterIsNotTurnedOn
gResetActivityLogFilter:
'MsgBox "pause for station identification"
'Select the cells:
Cells.Select
'Turn the filter Off
Selection.AutoFilter
'Turn the filter On
Selection.AutoFilter
'Go to the last cell on the sheet
ActiveCell.SpecialCells(xlLastCell).Select
iRow = Range(ActiveCell.Address).Row
'Go to Column A on the last cell in the sheet
Cells(iRow, 3).Select
'finished - resume standard code
GoTo gNoActivityLogAutoProcess
gActivityLogFilterIsNotTurnedOn:
'Select the cells:
Cells.Select
'Turn the filter Off
Selection.AutoFilter
'Go to the last cell on the sheet
ActiveCell.SpecialCells(xlLastCell).Select
iRow = Range(ActiveCell.Address).Row
'Go to Column A on the last cell in the sheet
Cells(iRow, 3).Select
'finished - resume standard code
GoTo gNoActivityLogAutoProcess
gNoActivityLogAutoProcess:
'''Debug.Print ActiveWorkbook.ReadOnly
'Only save the workbook if it is NOT "Read Only"
If ActiveWorkbook.ReadOnly = False Then ActiveWorkbook.Save
End Sub