Hi,
I have a macro here that pulls a workbook from a specific folder opens it and filters it. What I want is if the filter returns no results (No cells containing "No Comms (2+Days)") then a msg box that reads "No loggers to investigate today". I've tried so many different ways and nothing works. I'm certain there must be a really simple way of doing this that I'm missing. Basically if below the header is empty following "B1" being filtered then the msgbox to appear. Also I'd like the msgbox to appear prior to being copied and pasted. Thanks in advance for any help.
I have a macro here that pulls a workbook from a specific folder opens it and filters it. What I want is if the filter returns no results (No cells containing "No Comms (2+Days)") then a msg box that reads "No loggers to investigate today". I've tried so many different ways and nothing works. I'm certain there must be a really simple way of doing this that I'm missing. Basically if below the header is empty following "B1" being filtered then the msgbox to appear. Also I'd like the msgbox to appear prior to being copied and pasted. Thanks in advance for any help.
'Open_Selected_folder_via_file_path Workbooks.Open Filename:="V:\SZ\WMAGroups\Wessex Users\CCTs II\Intelligent Infrastructure (Flight Engineers)\REPORTS DL FOLDER\alarm-data*.xlsx" 'Looks_for_loggers_that_havent_comunicated_via_column_filter Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Selection.AutoFilter Selection.AutoFilter ActiveSheet.Range("$A$1:$E$781").AutoFilter Field:=2, Criteria1:= _ "No Comms (2+Days)" 'Auto_sizes_and_selects_via_relative_referencing_then_copies Columns("B:B").ColumnWidth = 55.14 Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy 'Selects_report_workbook_then_pastes_details_from_above_macro Windows("Reports Workbook.xlsm").Activate Range("B22").Select ActiveSheet.Paste Range("B22").Select 'Closes_Selected_workbook_and_supress_save_prompts Dim wb As Workbook Application.DisplayAlerts = False For Each wb In Application.Workbooks If wb.Name Like "alarm-data*" Then wb.Close Next wb Range("B2").Select End Sub |