jeudi 28 juillet 2016

If statement scenario

All,

I have a scenario where I want to exit sub if ("Summary").Range("C17").Text = "Yes" and either CBL or RBL does not equal zero. I thought the below code would work however if CBL = 0 and RBL = 100 the code will not exit sub.

 Dim CBL As Long
 CBL = Worksheets("Summary").Cells(97, Yearcol).Value
 Dim RBL As Long
 RBL = Worksheets("Summary").Cells(101, Yearcol).Value

'Check if prestage two projects
    If Worksheets("Summary").Range("C17").Text = "Yes" And RBL Or CBL <> 0  Then

Aucun commentaire:

Enregistrer un commentaire