View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tjtjjtjt tjtjjtjt is offline
external usenet poster
 
Posts: 51
Default Adv Filter Formula Criteria

I'm trying to access the Advanced Filter Programmatically. I have a crude
macro that runs to completion but falters on:

y.Range("C2").Formula = "=" & "OR(Source!J2<" & """""" _
& "," & "AND" & "(Source!K2<" & """""" _
& ",Source!K2<" & "" & """Consumer""" & "))" & ""

This is what ends up in the cell:
=OR(Source!#REF!<"",AND(Source!#REF!<"",Source!# REF!<"Consumer"))

It should be:
=OR(Source!J7<"",AND(Source!K7<"",Source!K7<"Co nsumer"))

How can I rewrite this so it will create a working formula in the cell? I
know criteria work because I can run the Advanced Filter successfully if I do
it manually.

--
tj