I am running Excel 2003 and I wish to apply conditional formatting to only cells with format Number. Does
anyone knows an easy way of doing this or a VBA code for it?
I have tried on my own to write a code , but as I am
new to VBA , I can't figure out how to make it work . The code supposed to compare all the numeric values from an uknown
number of columns with numeric values from column B row by row and Bold the ones greater. The number of columns and rows is
uknown because the data will be exported from another software to Excel , so bassically I wish to format a woorkbook to
automatically do that.
The code is below:
Dim Count As Integer
Dim Count1 As Integer
Dim nr1 As Range
Dim nr2 As Range
Dim nr3 As Range
Dim nr4 As Range
Dim nr5 As Range
Dim nr6 As Range
Dim nr7 As Range
Dim nr8 As Range
Set nr1 = Range("A65536").End(xlUp)
Set nr2 = Range("a1").End(xlToRight)
Count = Range("A1", nr2).Columns.Count - 1
Set nr3 = Range("A1", nr1.Offset(0, Count))
nr3.Name = "Data"
Set nr4 = Range("B65536").End(xlUp)
Set nr5 = Range("B7", nr4)
Set nr6 = Range("D7").End(xlToRight)
Set nr7 = Range("D65536").End(xlUp)
Count = Range("D7", nr6).Columns.Count - 1
Set nr8 = Range("D7", nr7.Offset(0, Count))
nr8.Name = "Values"
For Each r In nr8.Rows
i = r.Row
If IsNumeric(Cells(r)) = True And r.xlCellValue > nr5.xlCellValue = True Then
cell.Font.Bold = True
If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Thank you very much for any help received.