简体   繁体   中英

Textbox Change Event Error on Backspace --VBA Userform

I have 2 Text boxes on a user form: tbQty1, tbQty2. I want tbQty2 value to equal tbQty1.value * 2. The following simple code [_Change()] works unless I delete or backspace out the value of tbQty1. I get an run time error 13 type mismatch

Private Sub tbQty1_Change()

tbQty2.Value = tbDoorQty.Value * 2

End Sub

I have tried IF statements with tbQty1.value = "" etc. and Keypress ( IF KeyAscii = 8 Then tbQty1 = "" ). All blew up the same way I'm just missing something. Thanks for the help

If isnumeric(tbQty1.value) then
 'statements
end if

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM