ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   to find values between two values? (https://www.excelbanter.com/excel-programming/306072-find-values-between-two-values.html)

Peer

to find values between two values?
 
Hi,

I"m trying to build a search module in excel in which the user ca
define an minimum value and an maximum value to search for.
So I created a form with two textboxes for each category the user ca
search in. Now I already know how to make VBA find the absolute valu
of a textbox, I am using this code:

Dim d1 as integer
d1 = textbox2.text

If TextBox2.Value = True Then
Set c = Worksheets(Categorie.Value).Columns("D").Find(d1
ActiveCell, xlFormulas, _
xlPart, xlByColumns, xlNext, MatchCase:=False)
If Not c Is Nothing Then
c.Activate
Set c = Worksheets(Categorie.Value).Columns("D").FindNext( c)
End If
Else: Set c = Nothing
End If

But I want d1 to be the minimum value to search for and another valu
to be a maximum (this would be d2). When the user has defined these tw
values I want to module to search for values between these two values.
So if a user wants to search for values between 300 and 400 fo
example, the module should activate every cell in column D (I hav
other if-codes for other columns) containing a value between 300 an
400.

How should I do this?

Pee

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com