Results 1 to 6 of 6

Thread: [RESOLVED] Remove $ from text

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] Remove $ from text

    How to remove $ from listbox? I have text like this in my listbox. I want to remove all
    AAAAA$,
    BBB$
    CCC$
    ddd$

    I want to remove this symbol $ from text to be display like this

    AAAAA,
    BBB
    CCC
    ddd


    Code:
    For i = 0 To List1.ListCount - 1 'select sheet
            If List1.Selected(i) = True Then
            Dim sheet As String
                sheet = (List1.List(i))
            End If
        Next

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remove $ from text

    Code:
    For i = 0 To List1.ListCount - 1 'select sheet
            If List1.Selected(i) = True Then
            Dim sheet As String
                sheet = (List1.List(i))
                sheet = Replace(List1.List(i)),"$",""
            End If
        Next

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Remove $ from text

    It appear with red color when I paste it. Why?Mybe something wrong with this line

    Code:
    sheet = Replace(List1.List(i)),"$",""

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Remove $ from text

    I typed it off the top of my head, and got the parentheses messed up.

    It should be:
    Code:
    sheet = Replace(List1.List(i), "$", "")
    Sorry 'bout that.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Remove $ from text

    Thank you.. It work now

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] Remove $ from text

    And there really isn't any reason to continually recreate your variable, so I would move the Dim statement outside of the loop.

Posting Permissions

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



Click Here to Expand Forum to Full Width