Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DB DB is offline
external usenet poster
 
Posts: 46
Default change from message box to result in cell

I'm currently running this macro...
**********
Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
MsgBox lsum
End Sub
**********
Instead of the sum showing up in a message box, I'd like the sum to show up
in the next cell over. Can someone help me out on how to do that. I can't
seem to get it to work smoothly.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default change from message box to result in cell

Try this

Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
ActiveCell.Offset(0, 1).Value = lsum
End Sub

HTH
Regards,
Howard

"DB" wrote in message
...
I'm currently running this macro...
**********
Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
MsgBox lsum
End Sub
**********
Instead of the sum showing up in a message box, I'd like the sum to show
up
in the next cell over. Can someone help me out on how to do that. I can't
seem to get it to work smoothly.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
DB DB is offline
external usenet poster
 
Posts: 46
Default change from message box to result in cell

perfect, thank you for the help

"L. Howard Kittle" wrote:

Try this

Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
ActiveCell.Offset(0, 1).Value = lsum
End Sub

HTH
Regards,
Howard

"DB" wrote in message
...
I'm currently running this macro...
**********
Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
MsgBox lsum
End Sub
**********
Instead of the sum showing up in a message box, I'd like the sum to show
up
in the next cell over. Can someone help me out on how to do that. I can't
seem to get it to work smoothly.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default change from message box to result in cell

You have another response at your original post.

DB wrote:

I'm currently running this macro...
**********
Sub Sumcharacters()
Dim i As Long, s As String
Dim lsum As Long
For i = 1 To Len(ActiveCell)
s = Mid(ActiveCell, i, 1)
If IsNumeric(s) Then
lsum = lsum + CLng(s)
End If
Next
MsgBox lsum
End Sub
**********
Instead of the sum showing up in a message box, I'd like the sum to show up
in the next cell over. Can someone help me out on how to do that. I can't
seem to get it to work smoothly.

Thanks


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No change in result cell jiang Excel Worksheet Functions 1 September 20th 06 06:20 PM
Cell formual result change - Message al007 Excel Programming 1 November 15th 05 01:10 PM
How do I change the color of a cell depending on the result of the function in that cell Mo Childs[_2_] Excel Programming 4 November 1st 05 09:30 PM
Change the color of a cell change dependant on a result KFEagle Excel Programming 2 April 4th 05 02:20 PM
Change result #VALUE! to "message" rleonard Excel Programming 2 May 10th 04 07:20 PM


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"