'Change code to receive 1 label instead of multiple

My Code is giving me multiple labels when it is run. I think I know where the problem is but im not sure how to fix it. I would like 1 label to print if each visible cell in the range (AJ2:AJ43) has a value of "a" if not I would like the message "Check QA" to pop up instead of printing a label.

Sub PrintLabel()

Dim c As Range

    For Each c In Range("AJ2:AJ43").SpecialCells(xlCellTypeVisible)
    If c.Value = "a" Then
    
    Range("AI44,AI45").Select
    ActiveSheet.PageSetup.PrintArea = Selection.Address
    ActiveSheet.PrintOut copies:=1
    Range("AI44,AI45").Select

Else

MsgBox ("Check QA.")
End If Next c

End Sub


Solution 1:[1]

This should do it using a boolean to track the criteria.

Sub PrintLabel()

Dim c As Range
Dim printflag As Boolean
printflag = True
For Each c In Range("AJ2:AJ43").SpecialCells(xlCellTypeVisible)
    If Not c.Value = "a" Then
        printflag = False
    End If
Next c

If printflag Then
    ActiveSheet.PageSetup.PrintArea = Range("AI44,AI45")
    ActiveSheet.PrintOut copies:=1
Else
    MsgBox ("Check QA.")
End If
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Warcupine