+ Reply to Thread
Results 1 to 4 of 4

Clearing a value from a TextBox Automatically??

  1. #1
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Clearing a value from a TextBox Automatically??

    Hi all, i have put together some code to delete 3 items of data dependent on Textbox1 value....It works fine only, i can not get Textbox1 to clear the value or text in it after deletion,

    Any ideas?
    Here's the code

    Regards,
    Simon

    Dim mycell
    Dim rng As Range
    Worksheets("Stats12").Visible = True
    Set rng = Range("Statlist")
    For Each mycell In rng
    If mycell.Value = Worksheets("New stats").TextBox1.Value Then
    mycell.Value = ""
    mycell.Offset(0, 1) = ""
    mycell.Offset(0, 2) = ""
    Call playersort
    Worksheets("New stats").Select
    Worksheets("Stats12").Visible = False
    End If
    Next
    With Worksheets("New Stats")
    Worksheets("New Stats").Select
    TextBox1 = ""
    End With
    End Sub

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Hi all, Below is some code i use to delete some data, and i have now worked out clearing the Textbox, but i have one other problem, when the search takes place if the user hasn't typed the text or value to look for in the case in which it was typed it finds nothing how can i make it so that the case doesn't matter?

    Regards,
    Simon

    Dim mycell
    Dim rng As Range
    Worksheets("Stats12").Visible = True
    Set rng = Range("Statlist")
    For Each mycell In rng
    If mycell.Value = Worksheets("New stats").TextBox1.Value Then
    mycell.Value = ""
    mycell.Offset(0, 1) = ""
    mycell.Offset(0, 2) = ""
    Call playersort
    Worksheets("New stats").Select
    Worksheets("Stats12").Visible = False
    End If
    Next
    Call tboxClear
    End Sub

    Sub tboxClear()
    With Worksheets("New Stats")
    Worksheets("New Stats").Select
    If Range("A99").Value = "" Then
    Worksheets("New Stats").TextBox1.Value = ""

    End If
    End With
    End Sub

  3. #3
    Dave Peterson
    Guest

    Re: Clearing a value from a TextBox Automatically??

    if trim(Worksheets("New stats").TextBox1.Value) = "" Then
    exit sub
    end if

    If lcase(mycell.Value) = lcase(Worksheets("New stats").TextBox1.Value) Then
    ....



    Simon Lloyd wrote:
    >
    > Hi all, Below is some code i use to delete some data, and i have now
    > worked out clearing the Textbox, but i have one other problem, when the
    > search takes place if the user hasn't typed the text or value to look
    > for in the case in which it was typed it finds nothing how can i make
    > it so that the case doesn't matter?
    >
    > Regards,
    > Simon
    >
    > Dim mycell
    > Dim rng As Range
    > Worksheets("Stats12").Visible = True
    > Set rng = Range("Statlist")
    > For Each mycell In rng
    > If mycell.Value = Worksheets("New stats").TextBox1.Value Then
    > mycell.Value = ""
    > mycell.Offset(0, 1) = ""
    > mycell.Offset(0, 2) = ""
    > Call playersort
    > Worksheets("New stats").Select
    > Worksheets("Stats12").Visible = False
    > End If
    > Next
    > Call tboxClear
    > End Sub
    >
    > Sub tboxClear()
    > With Worksheets("New Stats")
    > Worksheets("New Stats").Select
    > If Range("A99").Value = "" Then
    > Worksheets("New Stats").TextBox1.Value = ""
    >
    > End If
    > End With
    > End Sub
    >
    > --
    > Simon Lloyd
    > ------------------------------------------------------------------------
    > Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
    > View this thread: http://www.excelforum.com/showthread...hreadid=547614


    --

    Dave Peterson

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Once again thanks Dave!
    Regards,
    Simon

+ 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