ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   advanced filternot working in macro (https://www.excelbanter.com/excel-programming/436151-advanced-filternot-working-macro.html)

tina

advanced filternot working in macro
 
Hi
A macro with advanced filter is nolonger working the advance filter does not
give any data but if run manually with sames settings it works. Problem
seems to been since upgraded to office 2007 . I recorded a amcro for filter
and ran this and this failed to give data when macro ran but did when recorded
relevant code is
Range("MYCODES").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range _
("I1:I2"), CopyToRange:=Range("K1"), Unique:=False
any Ideas
Thanks Tina

Charlize

advanced filternot working in macro
 

tina;557571 Wrote:
Hi
A macro with advanced filter is nolonger working the advance filter
does not
give any data but if run manually with sames settings it works.
Problem
seems to been since upgraded to office 2007 . I recorded a amcro for
filter
and ran this and this failed to give data when macro ran but did when
recorded
relevant code is
Range("MYCODES").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range _
("I1:I2"), CopyToRange:=Range("K1"), Unique:=False
any Ideas
Thanks TinaSub test()

'In excel 2007 you have to refer to every object. There are no
assumptions anymore
'Even if you are on the activesheet on which you want to perform an
action,
'you'll have to refer to it in your coding.
With ActiveWorkbook
With .ActiveSheet
Range("MYCODES").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=.Range("I1:I2"), CopyToRange:=.Range("K1"),
Unique:=False
End With
End With
End SubCharlize


--
Charlize
------------------------------------------------------------------------
Charlize's Profile: http://www.thecodecage.com/forumz/me...hp?userid=1168
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=153796

Microsoft Office Help



All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com