View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Don Guillett
 
Posts: n/a
Default Months auto-filter with year twist

One way might be to store the variable in a cell and use that reference

Sub togglenum()
If Range("f1") = 2006 Then
Range("f1") = 2005
Else
If Range("f1") = 2005 Then
Range("f1") = 2006
End If
End If
End Sub

--
Don Guillett
SalesAid Software

"yadaaa" wrote in
message ...

Hello,

I made a new toolbar with 12 buttons, each running a macro:

Selection.autofilter Field:=12, Criteria1:="=??/04/????",
Operator:=xlAnd

for april,

Selection.autofilter Field:=12, Criteria1:="=??/05/????",
Operator:=xlAnd

for may, etc.

but this gives me this month of all years.

i need a toggle button, that once pressed will put "2005", for example,
in this macros inswtead of the ????. and i will make one for 2006 as
well.

TIA


--
yadaaa
------------------------------------------------------------------------
yadaaa's Profile:
http://www.excelforum.com/member.php...o&userid=35130
View this thread: http://www.excelforum.com/showthread...hreadid=550611