natatbh ...
I had to post a few questions to get this to work. I am VB programmer and doing this for you has shown me just how little I know about VBA, but this works I believe exactly how you desire.
This is what I did ...
Create a UserForm and add it to the Workbook. Place a textbox on the Form.
In worksheet1 add this code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Tests active Cell if in "B" calls User form
If ActiveCell.Column = 2 Then
UserForm1.Show vbModal
End If
End Sub
In the textbox on the userform add this code:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Called by Selection_Change on Sheet1
'The last 2 lines should be moved to excel closing event.
'Just here for example
Dim strInput As String 'Used to hold User input
If Len(TextBox1) < 4 Then 'Bails out of Sub if Len less than desired length
Exit Sub
Else
KeyAscii = 0 'Deletes 5th character input
MsgBox ("Max 4 characters"

'Informs our User
End If
strInput = TextBox1.Text 'Fill our variable
ActiveCell.Value = strInput 'Fill Triggering cell with input
TextBox1 = "" 'Clear for next use
UserForm1.Hide 'Keep working in Excel
Set UserForm1 = Nothing 'Clean up our mess
End Sub
Change the length of the test to whatever you need. You MAY need to set a few properties of the textbox for a string 23 characters long. The only thing to remember is that the LEN function counts spaces, so you MAY need to trim them out before the test.
Sorry this took so long.
HTH
Michael