Conditional formatting: Format entire row based on single cell value and using defined names

Koekert

New Member
Joined
Apr 3, 2009
Messages
7
Hi all,

I'm kinda new in VB/VBA and I was wondering if the following is possible:

Currently I'm using a workbook, containing multiple sheets, to create a status overview. One of the sheet is used to list all open defects and contains information like unique ID, description, affected version, etc.

I would like to create a script that checks if the affected version matches with one of the two names defined (inserts->name->define). If not, the entire row should be formatted as bold, red.

I've tried the following but this only changes the single cell and the defined names are not used yet. Can anyone help?

Option Explicit
Dim mySheet, myCells
Dim curRow, curCol, curVal

Sub ConditionalFormat()

Set mySheet = ActiveWorkbook.Sheets("Issues")
Set myCells = mySheet.Cells

curRow = 2 'skip first row since this contains the header
curCol = 4 'check the affected version column

curVal = mySheet.Cells(curRow, curCol)

Do Until IsEmpty(curVal)

If curVal <> "Release" And curVal <> "HOME" Then 'Defined names should be used here
'ActiveCell.EntireRow.Select
'ActiveCell.EntireRow.Font.ColorIndex = 3

'Range(curRow: curRow).Font.ColorIndex = 3

myCells(curRow, curCol).Font.ColorIndex = 3
myCells(curRow, curCol).Font.Bold = True
End If

curRow = curRow + 1
curVal = mySheet.Cells(curRow, curCol)
Loop

End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,214,620
Messages
6,120,559
Members
448,970
Latest member
kennimack

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