Announcement

Collapse
No announcement yet.

If one cell is Not Blank but another cell in same row is Blank Then

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • If one cell is Not Blank but another cell in same row is Blank Then



    My macro goes through a spreadsheet list and sends emails with attachments.
    Need to add code which will give a Message Box if Sheet1.Cells(x, 3) is Not Blank but Sheet1.Cells(x, 5) Is Blank or is zero
    This needs to only evaluate a list in a range from row 6 down to row number in Sheet1.Range("D1")

  • #2
    Possibly...
    Code:
    Sub test()
        Dim x As Long
        Dim lRow As Long
        With Sheet1
            lRow = .Range("D1").Value
            For x = 6 To lRow
                If Not IsEmpty(.Cells(x, 3)) And IsEmpty(.Cells(x, 5)) Or .Cells(x, 5) = 0 Then
                    MsgBox "Need to add code which will give a Message Box"
                End If
            Next x
        End With
    End Sub

    Comment


    • #3


      This appears to work, but it keeps giving the message box for EVERY instance when that test is true. I need for the message box to come up only once, even if test is true for more than one line in the range.
      Do you know how to solve that?

      Comment

      Working...
      X