'Module: basModifyRange 'Purpose: Scan a range on a sheet and modify it 'Version: Excel 97 SR-1 ' Option Explicit ' 'Purpose: Modify a range ' Sub ModifyRange() Dim ColumnCount As Integer Dim ColumnIndex As Integer Dim RangeAddress As String Dim RangeObject As Range Dim RowCount As Integer Dim RowIndex As Integer Dim SheetName As String 'set sheet and range Set RangeObject = Workbooks("Actuals.xls").Sheets("Unit1").Range("C5:c338") ColumnCount = RangeObject.Columns.Count RowCount = RangeObject.Rows.Count 'scan columns For ColumnIndex = 1 To ColumnCount 'scan rows For RowIndex = 1 To RowCount ''if cell contains formula make it red 'If Left(RangeObject.Cells(RowIndex, ColumnIndex).Formula, 1) = "=" Then ' RangeObject.Cells(RowIndex, ColumnIndex).Font.ColorIndex = 3 'End If 'if cell contains 0 unlock it If Left(RangeObject.Cells(RowIndex, ColumnIndex).Formula, 1) = "0" Then RangeObject.Cells(RowIndex, ColumnIndex).Locked = False End If Next RowIndex Next ColumnIndex End Sub