Hi all,
I have a sheet generated by a software every month, so the layout is the same but more or less rows. For this I am writing a code to format it for us as we need it, to make reports from it, so we don't have to format it manually, and I am trying to add some conditional formatting to it but its just not exactly right.. can I get some help please?
So I have a column with "Something"s in it and I have a column with "Country"-ies in it, and it should never be possible to have "Something1" or "Something2" written beside anything else, only "Country1" or "Country2", but sometimes there are typos and they write the wrong "Something" to some countries and I'm trying set up a conditional formatting rule to highlight it for us if somewhere in the sheet there is "Something1" or "Something2" written beside a country that is not "Country1" or "Country2". I hope this makes sense. See the example attached for visual aid.
So here is my code to add this conditional formating:
Now my idea was to write it only to the first row of my table, and then copy the formatting which does the job perfectly when I do it manually, but the problem is, that this VBA code retunrs the actual string written into the cell ...Range(myronr, mycolnr), ...Range(myronr, myotrcolnr) so when I run this and go to manage rules under conditional formatting, I get this formula in the formula bar: =AND(OR(Something45="Something1",Something45="Something2"),AND(Country3<>"Country1",Country3<>"Country2"))![]()
Please Login or Register to view this content.
and thats not right.. I would need to get the cells address - C2 instead of Something45 and - D2 instead of Country3 but I don't know how to do that...
Is there a way to do this? Could someone help me please?
Please see the example sheet attached to help understand the problem.
Thank you all!
This question is also posted on Mr.Excel Message Board. Link:https://www.mrexcel.com/forum/excel-...ml#post5250188
Bookmarks