I used this code but nothing happens:

Private Function GetMiddleNumber(sNum As String) As Long
sNum = CStr(Val(txtKeyValue(0).Text))
If Len(sNum) Mod 2 = 0 Then
GetMiddleNumber = CLng(Mid(sNum, Len(sNum) / 2, 2))
Else
GetMiddleNumber = CLng(Mid(sNum, Len(sNum) / 2, 3))
End If
End Function

Private Sub cmdCompute_Click()
y = Val(txtLKeyValue.Text) - 1
For x = 0 To y
w = Len(txtKeyValue(x).Text)
If w <> Val(txtSKeyValue.Text) Then
MsgBox "Incorrect input"
txtKeyValue(x).SetFocus
Else
lblAnswer(0).Caption = GetMiddleNumber("123456789") ^ 2
End If
Next
End Sub