How to use conditional formatting in specific column each cells

seancoo

New Member
Joined
Nov 18, 2023
Messages
2
My code is not working

Error: Invalid procedure call and argument

Dim lr_cmp_frml As Long
Dim rng_cmp_frml As Range

'Find lr row in col G
lr_cmp = Cells(Rows.Count, "G").End(xlUp).Row

'Setup range
Set rng_cmp_frml = pws.Range("G5:G" & lr_cmp)

VBA Code:
'Format each cells
rng_cmp_frml.FormatConditions.Add xlCellValue, xless, "=0.59"
rng_cmp_frml.FormatConditions(1).Interior.Color = RGB(255, 127, 127)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It would help if you could provide your entire code, and also if you could post a small sample of your sheet using the XL2BB add in, or alternatively share your file via Google Drive, Dropbox or similar file sharing platform?
 
Upvote 1
Welcome to the MrExcel board!

It would help if you could provide your entire code
I agree with @kevin9999 on this. Also, please review my signature block below & its links about how to post vba code in the forum.

However, in relation to your problem, my best guess is that you change xless to xlLess

It also looks to me like lr_cmp in your code possibly should be lr_cmp_frml since that is what is in your variable declaration at the top.
 
Upvote 1

Forum statistics

Threads
1,215,165
Messages
6,123,390
Members
449,098
Latest member
ArturS75

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