Input Box Issue

Dkeller12

Board Regular
Joined
Oct 7, 2011
Messages
60
I am using the below code to search a column of data and I am getting an error when I enter a value that contains both numbers and letters (ex. 88006E) but does not cause an issue when using just numbers (ex. 880066). If I step through the process the error happens right after I enter the value in the input box and hit the OK in the box itself.

LSearchValue = InputBox("Please enter the CorpID to search for.", "Enter value")

What can be causing the problem? Is the input function itself limited to numerical values? I cannot figure it out.

Thanks in advance?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I am using the below code to search a column of data and I am getting an error when I enter a value that contains both numbers and letters (ex. 88006E) but does not cause an issue when using just numbers (ex. 880066). If I step through the process the error happens right after I enter the value in the input box and hit the OK in the box itself.

LSearchValue = InputBox("Please enter the CorpID to search for.", "Enter value")

What can be causing the problem? Is the input function itself limited to numerical values? I cannot figure it out.
You need to tell us what error you are getting (so we have some idea what might be going on)? Also, did you Dim the LSearchValue and, if so, as what data type? My bet is you Dim'med it as Integer or Long and 88006E is not one of those data types, but that is only a guess until you answer the two questions I asked.
 
Upvote 0
The error is just a generic error message that I entered using the "On Error GoTo" function. The LSearchValue is dim'med and it dim'med as Long. What data type should I adjust this to so it takes both numeric and alphanumeric entries?

Thanks for the help!
 
Upvote 0
The error is just a generic error message that I entered using the "On Error GoTo" function. The LSearchValue is dim'med and it dim'med as Long. What data type should I adjust this to so it takes both numeric and alphanumeric entries?
Dim LSearchValue As String
 
Upvote 0

Forum statistics

Threads
1,216,254
Messages
6,129,722
Members
449,529
Latest member
SCONWAY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top