View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
JEFFWI JEFFWI is offline
external usenet poster
 
Posts: 7
Default Building criteria string for Advanced Filter variable not resolvin

I am building a criteria string for an Advanced Filter feature. The string
values exist in a spreadsheet. I need to prepend ="= and append a trailing
quote. When I do the varialbe myCriteria does not resolve. Here is the code
snippet:

Dim iRow As Intege
Dim myCriteria As String
iRow = 2
For Each c In Worksheets("WatchCriteria").Range("A2:A19")
If c.Value < "" Then
myCriteria = c.Value
Worksheets("WatchList").Range(Cells(iRow, 2), Cells(iRow, 2)).Formula
= "=""=myCriteria"""
iRow = iRow + 1
End If
Next c

I want the actual value of the myCriteria variable to resolve within the
cell. Instead I get
="=myCriteria"

Can anyone suggest a way to do this?