ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA MACRO 4 ISNUMBER OPERATION (https://www.excelbanter.com/excel-discussion-misc-queries/152072-vba-macro-4-isnumber-operation.html)

FARAZ QURESHI

VBA MACRO 4 ISNUMBER OPERATION
 
Dear fellows,

I want a simple macro (Not Conditional Formatting), to detect cells in
column C:C that are either NOT numbers OR are below 5 and highlight them with
Blue Color background and Bold Red color fonts.

Regards

Bob Phillips

VBA MACRO 4 ISNUMBER OPERATION
 
Public Sub ProcessData()
Const TEST_COLUMN As String = "C" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1
If .Cells(i, TEST_COLUMN).Value < "" And _
(Not IsNumeric(.Cells(i, TEST_COLUMN).Value) Or _
Cells(i, TEST_COLUMN).Value < 5) Then
With .Cells(i, TEST_COLUMN)
.Interior.ColorIndex = 5
.Font.ColorIndex = 3
.Font.Bold = True
End With
End If
Next i

End With

End Sub

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Dear fellows,

I want a simple macro (Not Conditional Formatting), to detect cells in
column C:C that are either NOT numbers OR are below 5 and highlight them
with
Blue Color background and Bold Red color fonts.

Regards




FARAZ QURESHI

VBA MACRO 4 ISNUMBER OPERATION
 
Sorry Bob but code is not working!

Can you simply write a code to highlight the cell (C5) to Blue if its value
is not numeric and similarly...

highlight the cell (C6) to Blue if its value is numeric but below < 5?


"Bob Phillips" wrote:

Public Sub ProcessData()
Const TEST_COLUMN As String = "C" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1
If .Cells(i, TEST_COLUMN).Value < "" And _
(Not IsNumeric(.Cells(i, TEST_COLUMN).Value) Or _
Cells(i, TEST_COLUMN).Value < 5) Then
With .Cells(i, TEST_COLUMN)
.Interior.ColorIndex = 5
.Font.ColorIndex = 3
.Font.Bold = True
End With
End If
Next i

End With

End Sub

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Dear fellows,

I want a simple macro (Not Conditional Formatting), to detect cells in
column C:C that are either NOT numbers OR are below 5 and highlight them
with
Blue Color background and Bold Red color fonts.

Regards





Bob Phillips

VBA MACRO 4 ISNUMBER OPERATION
 
I responded to another question from you on that using conditional
formatting.

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Sorry Bob but code is not working!

Can you simply write a code to highlight the cell (C5) to Blue if its
value
is not numeric and similarly...

highlight the cell (C6) to Blue if its value is numeric but below < 5?


"Bob Phillips" wrote:

Public Sub ProcessData()
Const TEST_COLUMN As String = "C" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1
If .Cells(i, TEST_COLUMN).Value < "" And _
(Not IsNumeric(.Cells(i, TEST_COLUMN).Value) Or _
Cells(i, TEST_COLUMN).Value < 5) Then
With .Cells(i, TEST_COLUMN)
.Interior.ColorIndex = 5
.Font.ColorIndex = 3
.Font.Bold = True
End With
End If
Next i

End With

End Sub

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Dear fellows,

I want a simple macro (Not Conditional Formatting), to detect cells in
column C:C that are either NOT numbers OR are below 5 and highlight
them
with
Blue Color background and Bold Red color fonts.

Regards







FARAZ QURESHI

VBA MACRO 4 ISNUMBER OPERATION
 
Sorry BOB but your answer to the other question i.e. using feature of
Conditional Formatting was not useful. I simply want to know the structure of
a VBA CODE in this regard. Please let me know if u can.

Thanx

"Bob Phillips" wrote:

I responded to another question from you on that using conditional
formatting.

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Sorry Bob but code is not working!

Can you simply write a code to highlight the cell (C5) to Blue if its
value
is not numeric and similarly...

highlight the cell (C6) to Blue if its value is numeric but below < 5?


"Bob Phillips" wrote:

Public Sub ProcessData()
Const TEST_COLUMN As String = "C" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1
If .Cells(i, TEST_COLUMN).Value < "" And _
(Not IsNumeric(.Cells(i, TEST_COLUMN).Value) Or _
Cells(i, TEST_COLUMN).Value < 5) Then
With .Cells(i, TEST_COLUMN)
.Interior.ColorIndex = 5
.Font.ColorIndex = 3
.Font.Bold = True
End With
End If
Next i

End With

End Sub

--
HTH

Bob

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

"FARAZ QURESHI" wrote in message
...
Dear fellows,

I want a simple macro (Not Conditional Formatting), to detect cells in
column C:C that are either NOT numbers OR are below 5 and highlight
them
with
Blue Color background and Bold Red color fonts.

Regards








All times are GMT +1. The time now is 10:54 PM.

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