Clearing an integer variable

  • Thread starter Thread starter callbr549
  • Start date Start date
C

callbr549

I'm building a UserForm for data entry. I use a ComboBox to get a numeric
value and assign it to an integer (call it Prod). I put the value of Prod in
a cell of a worksheet.

If the user does not enter a value for Prod in the UserForm, I want the cell
on the worksheet to be blank. I tried Prod="" at the end of the sub, but that
gives a type mismatch error. I tried Prod=vbNull, but that puts a value of 1
in the cell. I tried Prod.ClearContents and that gave some other error
(don't remember which).

How do I make the value of an integer variable be empty?
 
Thank you. I had forgotten about the "Variant" data type. Your suggestion
appears to do exactly what I wanted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top