Hi there! Learned so much in this forum about vba. Just want to say thank you first.
The issue I run into this time is about if I can assign one variable to two cells with if statement.
To be precise, I have a list of data validation of yes and no (in cell C12). If yes, it means the ID of the product is in the report name, and I can use the ID (in cell A2) to find the corresponding report and open it. If no, it means the ID is not in the report name, so I have to use the product name (in cell A1) to find the report. So the code is like this:
then I will use find to look for rng
It didn't work. I wonder if I can assign rng to two cells? How can I get around this?
Thank you in advance!
The issue I run into this time is about if I can assign one variable to two cells with if statement.
To be precise, I have a list of data validation of yes and no (in cell C12). If yes, it means the ID of the product is in the report name, and I can use the ID (in cell A2) to find the corresponding report and open it. If no, it means the ID is not in the report name, so I have to use the product name (in cell A1) to find the report. So the code is like this:
VBA Code:
if range ("C12").value = "yes" then
rng = range("A2").value
else
rng = range("A1").value
then I will use find to look for rng
It didn't work. I wonder if I can assign rng to two cells? How can I get around this?
Thank you in advance!