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?
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
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