ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Method ; search area (https://www.excelbanter.com/excel-programming/283332-find-method-%3B-search-area.html)

CG Rosén

Find Method ; search area
 

Hi Group,

Have below code. ActiveSheet is WorkSheets(1). Is this the correct syntax
for the "search area"? Seems not to work.

Thanks for any hints.

Brgds

CG Rosén

Dim d
With Worksheets(4).Range("B1:B100") '????????
Set d = .Find(ComboBox1.Text, LookIn:=xlValues)
If d Is Nothing Then
MsgBox "OK"
Else
MsgBox "NIL"
End If
End With



libby

Find Method ; search area
 
Hi

Try this

With Worksheets(1).Range("B1:B100")
Set d = .Find(combobox1.text, LookIn:=xlValues)
If Not d Is Nothing Then
firstaddress = d.Address
MsgBox "OK"
Else
MsgBox "NIL"
End If
End With


You don't need to dim d as you are setting it.

-----Original Message-----

Hi Group,

Have below code. ActiveSheet is WorkSheets(1). Is this

the correct syntax
for the "search area"? Seems not to work.

Thanks for any hints.

Brgds

CG Rosén

Dim d
With Worksheets(4).Range

("B1:B100") '????????
Set d = .Find(ComboBox1.Text, LookIn:=xlValues)
If d Is Nothing Then
MsgBox "OK"
Else
MsgBox "NIL"
End If
End With


.



All times are GMT +1. The time now is 03:43 AM.

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