Hi,
How can I summarize the digits of a number from an Excel cell?
If I have 25252525 in A1, how can I get the sum (28) in B1 using code?
At this time I'm using the code shown below, but I would like to avoid creating columns which I have to delete later.
Thanks in advance for your help.
Sub Test()
'Text to columns
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array _
(5, 1), Array(6, 1), Array(7, 1), Array(8, 1))
ActiveCell.Offset(0, 8).Range("A1"
.Select
'Formula
ActiveCell.FormulaR1C1 = _
"=RC[-8]+RC[-7]+RC[-6]+RC[-5]+RC[-4]+RC[-3]+RC[-2]+RC[-1]"
End Sub
How can I summarize the digits of a number from an Excel cell?
If I have 25252525 in A1, how can I get the sum (28) in B1 using code?
At this time I'm using the code shown below, but I would like to avoid creating columns which I have to delete later.
Thanks in advance for your help.
Sub Test()
'Text to columns
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array _
(5, 1), Array(6, 1), Array(7, 1), Array(8, 1))
ActiveCell.Offset(0, 8).Range("A1"
'Formula
ActiveCell.FormulaR1C1 = _
"=RC[-8]+RC[-7]+RC[-6]+RC[-5]+RC[-4]+RC[-3]+RC[-2]+RC[-1]"
End Sub