Hello, Ive been loosing my mind trying to understand how to complete this macro based on a USERFORM.
The first If statement seems to work as planned.

Problem arises when I try to insure that the value a user inputs to the USERFORM/TextBox falls within Sheets(“BinConversion”).Range(“a” & I)
Anything outside of these numbers ">0 and <13" would MsgBox user to correct.

One of the secondary issues I can't seem to beat is if I backspace the TextBox to empty I get a Error 13 Mismatch (Debug: x = Bin1Input.Value
It's my limited understanding that the variable is a double and therefor an empty space is being read as a string, hence the mismatch.

Lastly, The looping is flawed as depending on how Ive tried to write the code. It either skips the first If Statement, or goes into death loop and I must restart Excel to stop the sub.


Private Sub Bin1Input_Change()

Dim x As Double
Dim I As Double

x = Bin1Input.Value

For I = 4 To 28
If x = Sheets(“BinConversion”).Range(“a” & I) Then
Sheets(“QLDailySheet”).Range(“b6”) = Sheets(“BinConversion”.Range(“b” & I)

ElseIf x = IsEmpty Then
MsgBox “Please Enter A Measurement Between 1 and 13 Meters”, vbExclamation
End If
Next
End Sub