Color shading vba

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,
Please does anyone know if there is a VBA code that can help me to perform this:
If a phase starts with M then look up column 4 and 5 in document 2 and fill the value in the tab with yellow shading.
If a phase starts wirth S then look up column 3 4 5 in document 2 and fill the value in the tab with yellow shading.
Thanks!

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
If all you care is that if a phrase starts with M or S, then you can use VLOOKUP and do a conditional formatting to color the cell



Some thing like this

=IF(LEFT(a1,1)="S", VLOOKUP(.....), IF(LEFT(A1,1)="S"), VLOOKUP(...), ""))

Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too
thanks for your reply.
But what if i am trying to input data from other document. I tried using "=IF(LEFT(a1,1)="S", VLOOKUP(.....), IF(LEFT(A1,1)="S"), VLOOKUP(...), "")) " by conditional formatting but i showed a message : "you may not use conditional formatting from other worksheet or other workbook".
Since i am looking up data from other document, how could this be solved??Thanks again.
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too