The code I am using is not entering the number typed in the textbox into the active cell. I am using this program to scan ISBN numbers and have them put into an array on the spreadsheet. the spreadsheet then looks up an associated price and returns the value. The number must be in number format when entered into the cell. Right now the command button is causing "" to be entered into the activecell.
Code:
Private Sub ib_total_Click()
Dim TextBox3 As Single
Dim TextBox4 As Single
Dim TextBox5 As Single
Dim TextBox6 As Single
Dim TextBox7 As Single
Dim TextBox8 As Single
Dim TextBox9 As Single
Dim TextBox10 As Single
Dim TextBox11 As Single
Dim TextBox12 As Single
Worksheets("Scan Search").Activate
Range("B15").Activate
'find the first blank scan table
If Not IsEmpty(ActiveCell) Then
Do Until ActiveCell = ""
ActiveCell.Offset(12, 0).Activate
Loop
End If
'enter first ISBN into form
'and check that a number is scaned
If Not isnumeric(TextBox3) Then
MsgBox "Please scan the order.", vbOKOnly, "No Scan"
Exit Sub
Else
ActiveCell = TextBox3
End If
'enter the rest of the scans into the form
If Not isnumeric(TextBox4) Then
ActiveCell.Offset(1, 0) = ""
Else
ActiveCell.Offset(1, 0) = Fix(TextBox4)
End If
If Not isnumeric(TextBox5) Then
ActiveCell.Offset(2, 0) = ""
Else
ActiveCell.Offset(2, 0) = Fix(TextBox5)
End If
If Not isnumeric(TextBox6) Then
ActiveCell.Offset(3, 0) = ""
Else
ActiveCell.Offset(3, 0) = Fix(TextBox6)
End If
If Not isnumeric(TextBox7) Then
ActiveCell.Offset(4, 0) = ""
Else
ActiveCell.Offset(4, 0) = Fix(TextBox7)
End If
If Not isnumeric(TextBox8) Then
ActiveCell.Offset(5, 0) = ""
Else
ActiveCell.Offset(5, 0) = Fix(TextBox8)
End If
If Not isnumeric(TextBox9) Then
ActiveCell.Offset(6, 0) = ""
Else
ActiveCell.Offset(6, 0) = Fix(TextBox9)
End If
If Not isnumeric(TextBox10) Then
ActiveCell.Offset(7, 0) = ""
Else
ActiveCell.Offset(7, 0) = Fix(TextBox10)
End If
If Not isnumeric(TextBox11) Then
ActiveCell.Offset(8, 0) = ""
Else
ActiveCell.Offset(8, 0) = Fix(TextBox11)
End If
If Not isnumeric(TextBox12) Then
ActiveCell.Offset(9, 0) = ""
Else
ActiveCell.Offset(9, 0) = Fix(TextBox12)
End If
'set the focus to the next scan table
ActiveCell.Offset(12, 0).Activate
End Sub
Last edited by a moderator: