+ Reply to Thread
Results 1 to 3 of 3

Removing concatenates for VBA calculs

  1. #1
    Registered User
    Join Date
    06-14-2005
    Posts
    41

    Question Removing concatenates for VBA calculs

    Hi,

    I would like suming numbers in cells. The only problem is that I concatenated them as followed : *546,23_$*
    I put the underscore for empty space which is a character by itself. I just don't know how to use together Left and Right function to move from 1 space from left and to go down 2 spaces from the right at the same time to only obtain the number and do maths with them. I must not change the concatenated cells in that process.

    When I concatenated the number and the *, it didn't keep the monatery format of the number. So I imitated the monetary format by this way. But I am opened to any bright ways to help me correct that matter too.


    Thx!

    Werner

  2. #2
    Tom Ogilvy
    Guest

    Re: Removing concatenates for VBA calculs

    Dim sStr as String
    Dim cell as Range
    Dim dblVal as double
    dim dblSum as double
    dblSum = 0
    for each cell in selection
    cell.activate
    sStr = Right(ActiveCell.Value,Len(ActiveCell.Value)-1)
    sStr = Left(sStr,len(activeCell.value)-3)
    dblval = cdbl(sStr)
    dblSum = dblSum + dblval
    Next
    msgbox dblSum

    --
    Regards,
    Tom Ogilvy

    "Werner" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > I would like suming numbers in cells. The only problem is that I
    > concatenated them as followed : *546,23_$*
    > I put the underscore for empty space which is a character by itself. I
    > just don't know how to use together Left and Right function to move
    > from 1 space from left and to go down 2 spaces from the right at the
    > same time to only obtain the number and do maths with them. I must not
    > change the concatenated cells in that process.
    >
    > When I concatenated the number and the *, it didn't keep the monatery
    > format of the number. So I imitated the monetary format by this way.
    > But I am opened to any bright ways to help me correct that matter too.
    >
    >
    >
    > Thx!
    >
    > Werner
    >
    >
    > --
    > Werner
    > ------------------------------------------------------------------------
    > Werner's Profile:

    http://www.excelforum.com/member.php...o&userid=24304
    > View this thread: http://www.excelforum.com/showthread...hreadid=383194
    >




  3. #3
    Registered User
    Join Date
    06-14-2005
    Posts
    41
    Thanks for your help Tom! I no more stuck. Futhermore, I think it's a well written code. Good job!

    Have a good day!

    Werner

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1