Macro - If bold then multiply by -1
Beware word-wrap
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== 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
If .Cells(i, TEST_COLUMN).Font.Bold Then
If IsNumeric(.Cells(i, TEST_COLUMN).Value) Then
.Cells(i, TEST_COLUMN).Value = _
.Cells(i, TEST_COLUMN).Value * -1
End If
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)
"Bob Phillips" wrote in message
...
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== 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
If .Cells(i, TEST_COLUMN).Font.Bold Then
If IsNumeric(.Cells(i, TEST_COLUMN).Value) Then
.Cells(i, TEST_COLUMN).Value = .Cells(i,
TEST_COLUMN).Value * -1
End If
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)
wrote in message
oups.com...
Hi there
I have number in column A
What I want to do is have a macro that can look down the column and if
the cell is bold then multiply the contents by -1 in order for me to
turn it into a negative figure.
I someone can help with this,
Thanks
Andrea
|