ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Formatting to VBA code (https://www.excelbanter.com/excel-programming/402944-conditional-formatting-vba-code.html)

Dean P.

Conditional Formatting to VBA code
 


I have a conditional formatting applied to my worksheet (Seattle)
within the spreadsheet. I would like to drop the Excel conditional
formatting and create a Excel VBA button that would apply the same
validations as the condtional formatting.

Listed below are two validations that only correspond to row 6 in the
worksheet (Seattle).

The button with the VBA code should include all rows for the worksheet.

Please help me with the code to complete this task.

Thanks,

Column C is Created with the following format
(=IF(OR(A6<"",B6<""),CONCATENATE(A6,"-",B6),""))

(Conditional 1)
=AND(COUNTIF(Duplicate_R,C6)+COUNTIF(Duplicate_E,C 6)1,C6<"")
(Color Blue)


Bob Phillips

Conditional Formatting to VBA code
 

For i = 2 To Cells(Rows.Count,"C").End(xlUp).Row
If Application.Countif(Range("Duplicate R", Cells(i,"C").Value + _
Application.Countif(Range("Duplicate E", Cells(i,"C").Value 1 And
_
Cells(i, "C").Value < "" then
Cells(i, "C").Interior.Colorindex = 5
End If
Next i

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Dean P." <Dean wrote in message
...


I have a conditional formatting applied to my worksheet (Seattle)
within the spreadsheet. I would like to drop the Excel conditional
formatting and create a Excel VBA button that would apply the same
validations as the condtional formatting.

Listed below are two validations that only correspond to row 6 in the
worksheet (Seattle).

The button with the VBA code should include all rows for the worksheet.

Please help me with the code to complete this task.

Thanks,

Column C is Created with the following format
(=IF(OR(A6<"",B6<""),CONCATENATE(A6,"-",B6),""))

(Conditional 1)
=AND(COUNTIF(Duplicate_R,C6)+COUNTIF(Duplicate_E,C 6)1,C6<"")
(Color Blue)





All times are GMT +1. The time now is 06:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com