Range Conditional Formatting conditions into VBA

miskov runec

New Member
Joined
May 4, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello all,

i will be very glad if someone can help me "transport" classic conditions i created in conditional formatting into VBA .

For example i have table where in column "W" 1:500 i have text which represents type of format of cell applied on cell in column K of the respected row.
So in cell K10 i have number 8 and W10 there is "m" or "pc" or "okruh" etc.

condition is: =ISNUMBER(SEARCH("m";$W1)) format of cell is: # ##0" m" applied to range: =$K$1:$K$500 or also on $L$1:$L$500
condition is: =ISNUMBER(SEARCH("pc";$W1)) format of cell is: # ##0" pc" applied to range: =$K$1:$K$500 or also on $L$1:$L$500
and other conditions in Slovak language where format depends on number in column K for example
condition is: =AND(ISNUMBER(SEARCH("okruh";$W1));OR($K1=0;$K1>4)) format of cell is: # ##0" okruhov" applied to range: =$K$1:$K$500 or also on $L$1:$L$500
condition is: =AND(ISNUMBER(SEARCH("okruh";$W1));AND($K1>=1;$K1<=4)) format of cell is: [=1]# ##0" okruh";[<5]0" okruhy"; applied to range: =$K$1:$K$500 or also on $L$1:$L$500

Thanks for any suggestions
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top