sum character

B

Bing

I have this situation:
Adress cell value
A10 A
A20 B
A30 C
A40 D
A50 E
A60 F
A70 G

I want to merge value all cell from A0 to A79 and put in cell A80 as
SUM(A0:A79) in numeric.
I want that value in cell A80 is ABCDEF.
For example
If delete row A30 value in A79(before A80) is ABDEF
If add row A20 and put value in cell X, value in A81(before A80) is AXBCDEF
Do you have any idea

Bing
 
P

plinius

Il 12/12/2012 10:33, Bing ha scritto:
I have this situation:
Adress cell value
A10 A
A20 B
A30 C
A40 D
A50 E
A60 F
A70 G

I want to merge value all cell from A0 to A79 and put in cell A80 as
SUM(A0:A79) in numeric.
I want that value in cell A80 is ABCDEF.
For example
If delete row A30 value in A79(before A80) is ABDEF
If add row A20 and put value in cell X, value in A81(before A80) is AXBCDEF
Do you have any idea

Bing

-----------------
Function SumC(rng As Range) As String
Dim c As Range
For Each c In rng
SumC = SumC & c
Next
End Function
 
B

Bing

-----------------
Function SumC(rng As Range) As String
Dim c As Range
For Each c In rng
SumC = SumC & c
Next
End Function
Sub sum()
Dim c As Range
For Each c In Range("E770:E790")
SumC = SumC & c
Next
ActiveCell.Value = SumC
End Sub

Thanks. It works

Another question
I want to select range with mouse instead of ("E770:E790")
 
P

plinius

Il 12/12/2012 12:11, Bing ha scritto:
Sub sum()
Dim c As Range
For Each c In Range("E770:E790")
SumC = SumC & c
Next
ActiveCell.Value = SumC
End Sub

Thanks. It works

Another question
I want to select range with mouse instead of ("E770:E790")

You can use "selection" instead of "E770:E790"
 
B

Bing

-----------------
You can use "selection" instead of "E770:E790"

Sub sum()
Dim c As Range
For Each c In Range("Selection")
SumC = SumC & c
Next
Range("E740").Activate
ActiveCell.Value = SumC
End Sub

select cell with mouse and start:
Run-time error '1004'
Method 'Range' of object '_Global' failed
debug in line For Each c In Range("Selection")

with
For Each c In Range(Selection)
same result
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top