# Can someone help me with this macro?

##### New Member
Hi Guys,
I'm new here and I'm enjoying programming with VBA now.
I wanna do a macro that can sum about 40 numbers from the active cell to the top.
The macro will check If the cell is a number, sum, and after the total will get in bold.
If a number already is bold, the sum will stop and That number that was in bold now will change for normal.
But when I'm run the code, the word "IsNumeric" shows me a error.
I did this at now :

Dim a As Long
Dim b As Long
Dim d As Variant
Dim x As Integer

a = ActiveCell.Row
b = ActiveCell.Column
x = 0

For x = 1 To 40
If IsNumeric((Cells((a - x), b))) & Cells((a - x), b) <> "" Then​
If x = 1 Then​
d = Cells((a - x), b)​
Else​
d = Cells((a - x), b) + d​
If (Cells((a - x), b).Font.Bold) Then​
Cells((a - x), b).Font.Bold = False​
x = 40​
End If​
End If​
Else​
x = 40​
End If​
Next x
ActiveCell.Value = d
ActiveCell.Style = "total1"
End Sub

The error is in the line "If IsNumeric((Cells((a - x), b))) & Cells((a - x), b) <> "" Then"
But I dont know why, 'cause this have been working, and suddently stopped

PS: Sorry for my bad english, I'm from Brazil.

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

#### JoeMo

##### MrExcel MVP
Haven't looked at all your code, but you can remove the immediate error by changing this:

If IsNumeric((Cells((a - x), b))) & Cells((a - x), b) <> "" Then

to this:

If IsNumeric((Cells((a - x), b))) And Cells((a - x), b) <> "" Then

Replies
2
Views
24
Replies
7
Views
74
Replies
0
Views
40
Replies
4
Views
48
Replies
8
Views
63