vendredi 30 novembre 2018

Excel VBA If Or Statement with integer and string?

The code below detects the value of 0 in excel and writes "0 Value" on the powerpoint it's exporting to, but it won't detect and do the same for the string value of "TEST WORDS" in excel. Instead it continues to write "NOT 0". What could I fix to get rid of the error?

        If Sheet1.Range("C" & Row).Value = 0 Or Sheet1.Range("C" & Row).Text = "MOB Speaker replacement" Then
            ppSlide2.AddTextbox(msoTextOrientationHorizontal, 855, 0, 105, 150).TextFrame.TextRange.Text = "0 Value"

    Else
            ppSlide2.AddTextbox(msoTextOrientationHorizontal, 855, 0, 105, 150).TextFrame.TextRange.Text = "NOT 0"
    End If

Aucun commentaire:

Enregistrer un commentaire