samedi 27 juin 2020

VBA IF statement

I'm using the below code to tell me when emails have been sent and display the text "sent" so I know there were no errors. But i was testing the code and I use a vlookup to display emails once i add the vendor name. My goal is to not let the macro debug and to let it keep going on to the next but at the same time let me know there was an error on one row either because that vendor did not have an email listed and I need to fill an email in. When i listed the vendors I left a cell blank to test code. Even tho i have valid emails and those emails sent the vba displays "Not sent" to the ones that were sent out. Since the macro could not find an email due to one cell being blank it debugged and next to all the valid emails the text "Not sent" populates. What am I missing or doing wrong? I just want to avoid debugs to tell me there is an error and just tell me that one row was "not sent" and to just keep sending the rest and populate those that do send with a "sent" text.

If Issent = True Then
Range("G" & i).Value = "Sent"
Else
Range("G" & i).Value = "Not Sent"
End If

Aucun commentaire:

Enregistrer un commentaire