mardi 27 janvier 2015

How to do a 3-part IF statement in VBA?


'8
If Not IsEmpty(Range("A7")) And Range("C7") = "\" Then
Range("W7") = "\"
ElseIf Not IsEmpty(Range("A7")) And Range("C7") <> "\" Then
Range("W7") = "\L"
ElseIf IsEmpty(Range("A7")) Then
Range("W7") = ""
End If

With Sheets("DL Data")
.Range("W7:W" & .Cells(.Rows.Count, "A").End(xlUp).Row).Formula = "\L"
End With


I cannot seem to figure out the WITH part, or maybe I am off on the IF statement all together. What I am trying to do here is this:


IF A7 is not empty AND it equals "\" THEN W7 equals "\", also IF A7 is not empty AND it does not equal "\" THEN W7 equals "\L", also IF A7 is empty THEN W7 equals blank


Then I would like it to do this to search through the Column and give me the appropriate answer, inserting blanks where necessary, inserting "\" where necessary and inserting "\L" where necessary.


Hope I am making myself clear here, thanks for all of the help in advance!


Regards,


Yazz


Aucun commentaire:

Enregistrer un commentaire