Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search for Value from InputBox

Good day,

I have a value that i get from an input box that i use to filter with,
giving me all the the rows with the criteria.
I would like excel to first check the row to see if the requested value
is there. If it is it must then carry on with the filter, if not i would
like a message box to pop up saying that the criteria requested is not
available.

Could somebody please help with some code on this.

Thanks

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Search for Value from InputBox

Something akin to

ans= =Inputbox(.... 'I am guessing this bit, fit to yours

If IsError(Application.Match(ans,Range("A1:A100"), 0)) Then
MsgBox "Not found"
Else
'do yuour thing
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tempy" wrote in message
...
Good day,

I have a value that i get from an input box that i use to filter with,
giving me all the the rows with the criteria.
I would like excel to first check the row to see if the requested value
is there. If it is it must then carry on with the filter, if not i would
like a message box to pop up saying that the criteria requested is not
available.

Could somebody please help with some code on this.

Thanks

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search for Value from InputBox

Hi Bob,

I treid it but it does not seem to work ? i have enterd both values that
are there and not and i get the message with both of them,despite the
fact that the variable ans still hase the vallue from the input box ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Search for Value from InputBox

Hi Tempy,

I did a test, albeit simple and cursory, and it worked okay there, so I
suspect something else is going on.

Can you post the code as you have it, and some sample data so that I can
test more accurately?

Bob


"Tempy" wrote in message
...
Hi Bob,

I treid it but it does not seem to work ? i have enterd both values that
are there and not and i get the message with both of them,despite the
fact that the variable ans still hase the vallue from the input box ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search for Value from InputBox

Hi Bob,

It is my error as the info it must look up is on another sheet !!

The sheet is called abbreviations, could you guide me as to how i would
look at the other sheet without opening it

Thanks for your help

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Search for Value from InputBox

inputbox returns a string.

Are you looking for a string (or a number or a date or what???)

Tempy wrote:

Hi Bob,

I treid it but it does not seem to work ? i have enterd both values that
are there and not and i get the message with both of them,despite the
fact that the variable ans still hase the vallue from the input box ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search for Value from InputBox

Hello Dave,

It can be just number or alpha or alpha numeric

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Search for Value from InputBox

Hi Tempy,

Something like

If IsError(Application.Match(ans,Worksheets("my sheet
name").Range("A1:A100"),0)) Then
MsgBox "Not found"
Else
'do yuour thing
End If

It may be better though to use some extra code to make it more readable,
such as

Set myRange = Worksheets("my sheet name").Range("A1:A100")

If IsError(Application.Match(ans,myRange,0)) Then
MsgBox "Not found"
Else
'do your thing
End If


or even name the range and use that name

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tempy" wrote in message
...
Hi Bob,

It is my error as the info it must look up is on another sheet !!

The sheet is called abbreviations, could you guide me as to how i would
look at the other sheet without opening it

Thanks for your help

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Search for Value from InputBox

Hi Bob,

works like a dream, i am a dabbler at this, thank you so much for your
help.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Search for Value from InputBox

I would have thought that if you were looking for numbers, then you still might
have trouble.



Tempy wrote:

Hello Dave,

It can be just number or alpha or alpha numeric

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


--

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
How do I search excel spreadsheets using multiple search criteria. Kasper Excel Worksheet Functions 4 December 15th 05 12:26 AM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
inputbox help lothario[_60_] Excel Programming 4 December 7th 03 12:26 AM
inputbox defj Excel Programming 4 November 26th 03 10:25 PM


All times are GMT +1. The time now is 05:38 AM.

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"