From: ELDANS on 14 May 2010 18:19 I have written a macro that runs an autofilter which grabs cell info from a different worksheet within that workbook (an entered date). It then uses that date to autofilter. It works fine the first time, but aparently plugs that info permanently into the macro and will not work on subsequent runs. I need a macro that will grab variable info from a certain cell each time and run with that new cell value each time. Any ideas?. (& yes, I am a newbee) sorry..
From: Gary''s Student on 14 May 2010 18:31 Your problem is refreshing the autofilter. It is best to clear the old filter before applying the new filter. Here is an example: Sub puralator() Dim s As String s = Sheets("Sheet2").Range("A1").Value Sheets("Sheet1").Activate Range("A1").Select Selection.AutoFilter Selection.AutoFilter Field:=1 Selection.AutoFilter Field:=1, Criteria1:=s End Sub -- Gary''s Student - gsnu201003 "ELDANS" wrote: > I have written a macro that runs an autofilter which grabs cell info from a > different worksheet within that workbook (an entered date). It then uses that > date to autofilter. It works fine the first time, but aparently plugs that > info permanently into the macro and will not work on subsequent runs. I need > a macro that will grab variable info from a certain cell each time and run > with that new cell value each time. Any ideas?. (& yes, I am a newbee) > sorry..
From: Gord Dibben on 14 May 2010 18:40 Maybe use ActiveCell.value instead of Range("A1").value as filter criterion but hard to say without seeing your code. Gord Dibben MS Excel MVP On Fri, 14 May 2010 15:19:01 -0700, ELDANS <ELDANS(a)discussions.microsoft.com> wrote: >I have written a macro that runs an autofilter which grabs cell info from a >different worksheet within that workbook (an entered date). It then uses that >date to autofilter. It works fine the first time, but aparently plugs that >info permanently into the macro and will not work on subsequent runs. I need >a macro that will grab variable info from a certain cell each time and run >with that new cell value each time. Any ideas?. (& yes, I am a newbee) >sorry..
|
Pages: 1 Prev: copy a from a cell to another with desired format Next: Count Unique Combinations |