How to check if mandatory fields are filled in?
===

I want to check the my worksheet for text in mandatory fields before I save my file. If cells B50:B53 has a text, corresponding cells D50:D53 are mandatory. If cells B50:B53 are empty, corresponding fields in column D are optional.

If I apply this rule to one row it works with the following code. However, I want to test all cases (B50 and D50, B51 and D51...). How can I do this without copying the code 4 times?

    Dim MsgStr As String
    Dim ws As Worksheet, r As Range, g As Range    

    Set ws = wb.Sheets("Allotment hotel")
    Set r = ws.Range("B50").Cells
    Set g = ws.Range("D50").Cells

    If r <> "" And g = "" Then
        MsgStr = "Room type was not found in the sheet 'Allotment hotel'"
    End If