PC Review


Reply
Thread Tools Rate Thread

change from message box to result in cell

 
 
=?Utf-8?B?REI=?=
Guest
Posts: n/a
 
      1st Mar 2007
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
 
Reply With Quote
 
 
 
 
L. Howard Kittle
Guest
Posts: n/a
 
      1st Mar 2007
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" <(E-Mail Removed)> wrote in message
news:55DF90BC-BFC0-4C44-A822-(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?REI=?=
Guest
Posts: n/a
 
      1st Mar 2007
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" <(E-Mail Removed)> wrote in message
> news:55DF90BC-BFC0-4C44-A822-(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Mar 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change cell colour on formula result change, no conditional format roster_jon Microsoft Excel Programming 0 2nd Dec 2008 12:11 PM
Cell formual result change - Message al007 Microsoft Excel Programming 1 15th Nov 2005 01:10 PM
How do I change the color of a cell depending on the result of the function in that cell Mo Childs Microsoft Excel Programming 4 1st Nov 2005 09:30 PM
Change the color of a cell change dependant on a result =?Utf-8?B?S0ZFYWdsZQ==?= Microsoft Excel Programming 2 4th Apr 2005 02:20 PM
Using a function result in one cell to change a format in another cell =?Utf-8?B?QW5kcmV3IEJhcm5lcw==?= Microsoft Excel Misc 4 28th Jan 2004 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:42 PM.