ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Array variable in FIND function (https://www.excelbanter.com/excel-programming/344313-re-using-array-variable-find-function.html)

JMB

Using Array variable in FIND function
 
You could also define your array like this.

Dim SearchIn As Variant
SearchIn = Array("*employment *government","*employment *manufacturing")


"GreenInIowa" wrote:

I am using the following code to FIND "employment " and "government" and the
code is working fine.

Set rngia = Cells(i, 1).Find(What:="*employment *government",
LookIn:=xlValues, Lookat:=xlPart)

But I have others searches to do and thus, would like to use an array
variable for "What:=". Is this possible?

I tried to define "SearchIn" as array variable and used in FIND function,
but it is giving me error. I was wondering why?

Dim SearchIn As Range

SearchIn(1) = "*employment *government"
SearchIn(2) = "*employment *manufacturing"

Set rngia = Cells(i, 1).Find(What:=SearchIn(n), LookIn:=xlValues,
Lookat:=xlPart)

Thanks.



All times are GMT +1. The time now is 01:22 PM.

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