Peter F
Peter F

Reputation: 435

Excel Inputbox displaying 0 instead of empty string

I am working on an excel vba project and have run into an odd issue. I am working inside of a button click sub and want to display the current note as the default while they update the note. Unfortunately, all empty cells show up with a default value of "0". The msgbox just before is for debugging purposes and it shows "" (nothing). Any ideas?

MsgBox Sheet4.Range("E" & stallToAdd + 1)
inputFromUser = Application.InputBox("Update note: ", "Update Note", Sheet4.Range("E" & stallToAdd + 1))

Edit: inputFromUser is a variant, stallToAdd is an integer.

Upvotes: 1

Views: 99

Answers (1)

Gene Skuratovsky
Gene Skuratovsky

Reputation: 581

Just convert it to a string like this:

inputFromUser = Application.InputBox("Update note: ", "Update Note", _
    CStr(Sheet4.Range("E" & stallToAdd + 1)))

Upvotes: 1

Related Questions