Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2002
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    macro help Plz... (XP)

    My favorite stock market page has recently changed their reporting format.
    The indices and stock daily changes are now reported as:

    "Change"
    Down 84.56
    Down 6.58
    Up 10.73
    Down 1.02
    Up 0.12
    Down 0.20
    Up 0.118
    Down 0.58
    0.00
    Down 0.429
    .......

    I need a sub-macro to use with my Index Lookup that will extract only the numerical value, rounded to either 0 or 2 places, with a "+" or a "-" or "nothing" depending on rather the "number is preceded by Down, Up or nothing.

    At the moment my mind is a blank so I'd appreciate some help...

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: macro help Plz... (XP)

    Some code like this perhaps. The key is the dual SUBSTITUTE of "-" for "Down" and a null string("") for "Up"

    Steve

    <pre> For Each rcell In rng
    With Application.WorksheetFunction
    rcell.Value = _
    .Substitute(.Substitute(rcell.Value, "Down", "-"), "Up", "")
    End With
    Next
    </pre>


  3. #3
    New Lounger
    Join Date
    Jan 2002
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macro help Plz... (XP)

    aaaaaaaaaaahhhhhhh...

    Substitute, that's what I was missing~

    thanks [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

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