PDA

View Full Version : Number To Letter



sooty8
08-10-2010, 06:51 AM
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.


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


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

Bob Phillips
08-10-2010, 07:07 AM
Try this




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


and so on

sooty8
08-10-2010, 08:35 AM
Hi xld

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

Cheers

Sooty8.