Variable data to copy in to filters "comments"

G

Guest

The problem is that the data in ("F1") is variable.
When i record a macro, the data that is in ("F1") the first time stays in "criteria1".
I need it to change when the data changes in ("F1")
How to do this?

Range("F1").Select
Selection.Copy
Sheets("Recepten").Select
Selection.AutoFilter Field:=5
Selection.AutoFilter Field:=4, Criteria1:="=IMP12-C", Operator:

Thanks all
 
D

Dave Peterson

...., Criteria1:="=IMP12-C", ...

could be:

...., Criteria1:=range("F1").value, ...
 
G

Guest

Sorry but that did't do it.
The data in F1 also comes from an other Sheet but i don't think that should mather.
 
D

Dave Peterson

Do you mean that the F1 cell you're looking at is on another worksheet?

If yes:
....., Criteria1:=worksheets("otherworksheet").range("F1").value, ...

If no:
You sure that the value in F1 actually occurs in your lookup range?

That change works for me when there's data to match.
 
D

Dave Peterson

They usually work the second time!

But I should have noticed in your code that you were changing sheets (or at
least it looked that way).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top