So I have a code set up which emails the data in a worksheet ("Sheet2"). However I need to set up the .to address so that it is dependant on different values on the sheet. ("J7") & ("J9").
I can hard code this fine.
However I would prefer to use a lookup from the sheet ("LookupLists"), so something like
But for the code to look up the value in the Named range and then use the row number to reference the cell in the Email Named Range.
Any help would be appreciated, thanks
I can hard code this fine.
Code:
Dim Recipient As String
If Range("J7") = "VALUE1" Then
Recipient = "Email1"
Else
If Range("J7") = "VALUE2" Then
Recipient = "Email2"
...etc
However I would prefer to use a lookup from the sheet ("LookupLists"), so something like
Code:
If Sheets("Sheet2").Range("J7").Value = Sheets("LookupLists").Range("A20").Value Then
Recipient = Sheets("LookupLists").Range("B20").Value
But for the code to look up the value in the Named range and then use the row number to reference the cell in the Email Named Range.
Any help would be appreciated, thanks