Consulting

Results 1 to 3 of 3

Thread: Number To Letter

  1. #1
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    188
    Location

    Number To Letter

    Hi All

    The following userform textboxes code read from the sheet and fill
    the textboxes automatically when the data is found after entering a value in Tb1B.

    [VBA]
    Private Sub Enter_Click()
    Application.ScreenUpdating = False
    Dim c As Range, Cntrl As Control
    On Error Resume Next
    Set c = Columns(3).Find(Tb1B, LookIn:=xlValues, LookAt:=xlWhole)
    TB700 = c.Offset(, 1)
    TB701 = c.Offset(, 2)
    TB702 = c.Offset(, 3)
    TB703 = c.Offset(, 4)
    TB704 = c.Offset(, 5)
    TB705 = c.Offset(, 6)
    TB706 = c.Offset(, 7)

    Application.ScreenUpdating = True
    End Sub
    [/VBA]

    After the data enters the textboxes above it is always numeric within a range of 1 to 7 if a textbox above has a numeric value then I need them
    to automatically change to a letter as listed below. If there is no numeric value in the textbox then no letter is entered.

    TB700 = A
    TB701 = B
    TB702 = C
    TB703 = D
    TB704 = E
    TB705 = F
    TB706 = G

    Any Help much appreciated.

    Sooty8

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this

    [vba]


    Private Sub TB700_Change()
    Static fReEntry As Boolean

    If Not fReEntry Then

    fReEntry = True
    TB700.Text = Chr(TB700.Text + 64)
    fReEntry = False
    End If

    End Sub
    [/vba]

    and so on
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    188
    Location
    Hi xld

    Many thanks for your help - with a bit of fiddling about manged to get it all working OK.

    Cheers

    Sooty8.

Posting Permissions

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