Results 1 to 4 of 4

Thread: Remove comma from a textbox
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular kelly mort's Avatar
    Join Date
    Apr 2017
    Location
    Suhum, Ghana, West Africa
    Posts
    1,510
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Remove comma from a textbox

    Code:
    Private Sub lstView_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        Dim n As Integer, ac As Integer, i As Integer
            i = Me.lstView.ListIndex
        With lstView
            For ac = 1 To .ColumnCount
                .TextColumn = ac
                Me.Controls("Rw" & ac).Value = .Text
            Next ac
        End With
    End Sub

    I am using this code to load data to my textboxes. The number columns are formatted to accounting and the comma is affecting my calculations on the userform. Textboxes with those comma are not calculated.

    so I am looking for a way to remove any comma when I load the textboxes with the above code. It can be, remove the comma before the data reaches the textbox or load it before removing it.

    Whatever works is cool. But the earlier is cooler

    Thanks
    There Is Always A Better Way

  2. #2
    Board Regular Akuini's Avatar
    Join Date
    Feb 2016
    Location
    Indonesia
    Posts
    2,058
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    4 Thread(s)

    Default Re: Remove comma from a textbox

    Maybe this:

    Code:
    Me.Controls("Rw" & ac).Value = Replace(.Text, ",", "")

  3. #3
    Board Regular kelly mort's Avatar
    Join Date
    Apr 2017
    Location
    Suhum, Ghana, West Africa
    Posts
    1,510
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Remove comma from a textbox

    Quote Originally Posted by Akuini View Post
    Maybe this:

    Code:
    Me.Controls("Rw" & ac).Value = Replace(.Text, ",", "")

    Brilliant! !!

    Thanks
    There Is Always A Better Way

  4. #4
    Board Regular Akuini's Avatar
    Join Date
    Feb 2016
    Location
    Indonesia
    Posts
    2,058
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    4 Thread(s)

    Default Re: Remove comma from a textbox

    You're welcome & thanks for the feedback.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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