mercredi 11 octobre 2017

VBA if conditions

I wrote if condition which is shown below, it looks for value "Current Status:" in row A and copy B value from that row to other sheet, if not not found "0" is placed in a cell, it works fine. Sometimes value "Current Status:" might be in a different cell than A18, it might show up in the range from A16 to A20, how can I modify that code to find it within the range and copy corresponding value?

If ws.Range("A18") = "Current Status:" Then
    .Range("V" & NewRow) = ws.Range("B18")
     Else
        .Range("V" & NewRow) = "0"
      End If

Aucun commentaire:

Enregistrer un commentaire