View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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.