#1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default Inputbox with VBA

Hello,

I have this procedu
iMatch = Application.Match(908, Range("A:A"), 0)
I need help to include an Inputbox that would prompt the user to enter "908".
The inputbox msg should read " Customer number"
--
Regards,
Jeff

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Inputbox with VBA

Dim ans
Dim fValid As Boolean

fValid = False
Do
ans = InputBox("Input Customer Number")
If ans = "" Then
Exit Sub
Else
If IsNumeric(ans) Then
If ans 0 Then
fValid = True
iMatch = Application.Match(ans, Range("A:A"), 0)
'more code
End If
End If
End If
Loop Until fValid

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jeff" wrote in message
...
Hello,

I have this procedu
iMatch = Application.Match(908, Range("A:A"), 0)
I need help to include an Inputbox that would prompt the user to enter

"908".
The inputbox msg should read " Customer number"
--
Regards,
Jeff



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Inputbox with VBA

dim CustNumber as long
dim iMatch as variant
custNumber = application.inputbox(prompt:="Customer Number",type:=1)
if custnumber = 0 then
exit sub
end if

imatch = Application.Match(custnumber, Range("A:A"), 0)
if iserror(imatch) then
'not found
else
'found
end if

application.inputbox with type:=1 forces the user to enter numbers.


Jeff wrote:

Hello,

I have this procedu
iMatch = Application.Match(908, Range("A:A"), 0)
I need help to include an Inputbox that would prompt the user to enter "908".
The inputbox msg should read " Customer number"
--
Regards,
Jeff


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Inputbox with VBA

I think this:
iMatch = Application.Match(ans, Range("A:A"), 0)
needs to be:
iMatch = Application.Match(clng(ans), Range("A:A"), 0)
if that table is really numbers.


Bob Phillips wrote:

Dim ans
Dim fValid As Boolean

fValid = False
Do
ans = InputBox("Input Customer Number")
If ans = "" Then
Exit Sub
Else
If IsNumeric(ans) Then
If ans 0 Then
fValid = True
iMatch = Application.Match(ans, Range("A:A"), 0)
'more code
End If
End If
End If
Loop Until fValid

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jeff" wrote in message
...
Hello,

I have this procedu
iMatch = Application.Match(908, Range("A:A"), 0)
I need help to include an Inputbox that would prompt the user to enter

"908".
The inputbox msg should read " Customer number"
--
Regards,
Jeff


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Text in an InputBox appear as asterisks? Chickyzee Excel Discussion (Misc queries) 0 January 16th 06 08:37 PM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM
Excel Inputbox Frank Excel Discussion (Misc queries) 1 May 19th 05 10:55 AM
Checkmark instead of InputBox daniel chen Excel Discussion (Misc queries) 4 April 17th 05 05:19 PM
Inputbox with Listbox Jeff Excel Discussion (Misc queries) 3 December 22nd 04 05:54 PM


All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"