Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

how can i replace \"\" with 0 ( to prevent type mismatch error, 13) I have a pro

ID: 640486 • Letter: H

Question

how can i replace "" with 0 ( to prevent type mismatch error, 13)

I have a problem,

I have some text boxes in a user form that looks up figures from a data base,

Than i edit some other text boxes & when i submit the form the total is worked out and entered in to a sheet.

The problem is that if there isn't a figure in the lookup cell in data base, the value of the text box gets "" (instead of "0"), as this is the value in a empty cell

So when i submit form, it calculates figures in the text boxes together with "" in some boxes (example: 15 + 45 +"" +300 + "")

& as you expect, the error 13 appear.

Does someone have any idea to correct it?

The code im using now is:

UserForm.TextBox12.Value = Cell1.Offset(0, -23).Value

Thanks before hand !!

Explanation / Answer

Hi..

Hi,

One way

If Len(Cell1.Offset(0, -23)) = 0 Then.
UserForm.TextBox12.Value = 0
Else
UserForm.TextBox12.Value = Cell1.Offset(0, -23).Value:
End If