lucasandrade05
New Member
- Joined
- Oct 9, 2014
- Messages
- 1
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
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
Please help me
PS: Sorry for my bad english, I'm from Brazil.
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 xActiveCell.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
Please help me
PS: Sorry for my bad english, I'm from Brazil.