Thread: sum character
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
bing bing is offline
external usenet poster
 
Posts: 8
Default sum character

-----------------
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")


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