Thread: Input box
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lazzzx Lazzzx is offline
external usenet poster
 
Posts: 24
Default Input box

Hi,
The result from the inputbox is stored in the fin variable. Yous should
replace [H14].value with "fin" and it should work perfect.

ActiveSheet.Range("$A$15:$n$500 ").AutoFilter Field:=1, Criteria1:="=*" &
fin & "*"

if you have a changing number of rows in your database, you can make it more
dynamic by:
ActiveSheet.Range("$A$15).CurrentRegion.AutoFilter Field:=1, Criteria1:="=*"
& fin & "*"

this will only work, if you have no empty rows in your data. Furthermore
range("A14:N14) shoud be empty cells to avoid these to be included into the
currentregion.

br
Lazzzx

"inès" skrev i meddelelsen
...
Hello

I would like to use an input box to find in my excel data base some
information.
I have been able to create the input box and the vba code to find a word
or
the sentence but if i put both together it doesn't work anymore.
Could you please help me.

The code which i have create is as follow:

Sub Find()

Dim rangeCel As Range
Dim compt As Integer
Dim fin As String

fin = Application.InputBox(Prompt:="KUNDE", Type:=2)
ActiveSheet.Range("$A$15:$n$500 ").AutoFilter Field:=1, Criteria1:="=*" &
[H14].Value & "*"

End Sub

Thanks a lot

Inès