+ Reply to Thread
Results 1 to 16 of 16

TextBox Change Event HELP

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: TextBox Change Event HELP

    @Mehmetcik. Thank for the help. Although I'm not an expert with VBA, however, from the 2nd code, it seems like you assume I'm using a form. But I don't. I'm using the ActiveX control TextBox. I have attached the spreadsheet for reference

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: TextBox Change Event HELP

    No Spreadsheet Seen.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: TextBox Change Event HELP

    The following seems to work.

    I created the textbox using "Developer - Insert - Textbox"

    I opened the revelent macro module by clicking on Design Mode then right clicking on the text box and selecting view code.
    Paste the text below into that window.

    Deselect Design mode.

    ENJOY.



    Public oldvalue As Double
    Private Sub TextBox1_Change()
    temp = TextBox1.Value
    If Right(temp, 1) = "%" Then temp = Left(temp, Len(temp) - 1)
    If Not IsNumeric(temp) Then temp = oldvalue
    oldvalue = temp

    TextBox1.Value = Format(oldvalue / 100, "0.00%")
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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