didijaba
Well-known Member
- Joined
- Nov 26, 2006
- Messages
- 511
HI, first thanks for any help you can give me. I have userform with one textbox (Reg2). When I fill it with number it does not recognise numbers in cells that are same as string in inputbox?? How can I solve this?
Code:
Private Sub Reg2_Change()
Dim i As Long
If Sheet3.Cells(1, 11) = "FORM_3" Then
With Sheet6
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 1 To lastrow
If UserForm1.Reg2.Text <> Sheet6.Cells(i, 1).Value Then
Exit Sub
Else
Exit For
End If
Next i
Dim InvNumber As String
InvNumber = UserForm1.Reg2.Text
With Sheet7
lastrow3 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 1 To lastrow3
Select Case Val(UserForm1.txtMemNo.Text)
Case Sheet7.Cells(i, 1).Value
Select Case Sheet7.Cells(1, 6).Value
Case Sheet7.Cells(i, 2).Value
Select Case Sheet7.Cells(i, 3)
Case vbNull
Sheet7.Cells(i, 3) = CDate(Format(Now(), "dd/mm/yy hh:mm:ss"))
MsgBox "ITEM IS GIVEN!"
Exit For
Case Is <> vbNull
Select Case Sheet7.Cells(i, 4).Value
Case vbNull
Sheet7.Cells(i, 4) = CDate(Format(Now(), "dd/mm/yy hh:mm:ss"))
MsgBox "ITEM IS RETURNED"
Exit For
Case Is <> vbNull
End Select
End Select
Case Is <> Sheet7.Cells(i, 2)
With Sheet7
.Cells(lastrow3 + 1, 1) = Val(UserForm1.txtMemNo.Text)
.Cells(lastrow3 + 1, 2) = Val(InvNumber)
.Cells(lastrow3 + 1, 3) = CDate(Format(Now(), "dd/mm/yy hh:mm:ss"))
End With
MsgBox "ITEM IS GIVEN"
Exit For
End Select
Case Is <> Sheet7.Cells(i, 1).Value
With Sheet7
.Cells(lastrow3 + 1, 1) = Val(UserForm1.txtMemNo.Text)
.Cells(lastrow3 + 1, 2) = Val(InvNumber)
.Cells(lastrow3 + 1, 3) = CDate(Format(Now(), "dd/mm/yy hh:mm:ss"))
End With
MsgBox "ITEM IS GIVEN"
Exit For
End Select
Next i
End If
End Sub
Last edited: