PC Review


Reply
Thread Tools Rate Thread

Advanced filter macro error

 
 
Boss
Guest
Posts: n/a
 
      15th Dec 2008
Hi,

what does this gives an error.

Sub compare()
Sheets("new").Select
lr = Cells(65536, 1).End(xlUp).Row
lc = Range("IV1").End(xlToLeft).Column

'Range(Cells(1, 1), Cells(lr, lc)).Select


Sheets("old").Select
Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Sheets("new").Range(lr, lc), Unique:=False


please help
Thanks!
Boss
 
Reply With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      15th Dec 2008
Hi
Your criteria range
Sheets("new").Range(lr, lc)

is one cell.
Do you mean

Sheets("new").Select
lr = Cells(65536, 1).End(xlUp).Row
lc = Range("IV1").End(xlToLeft).Column

With Sheets("new")
'note the dots. No need to select and it won't help
Set CritRange = .Range(.Cells(1, 1), .Cells(lr, lc))
end with
Sheets("old").Select
Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Critrange, Unique:=False

regards
Paul


On Dec 15, 12:00*pm, Boss <B...@discussions.microsoft.com> wrote:
> Hi,
>
> what does this gives an error.
>
> Sub compare()
> Sheets("new").Select
> * * lr = Cells(65536, 1).End(xlUp).Row
> * * lc = Range("IV1").End(xlToLeft).Column
>
> 'Range(Cells(1, 1), Cells(lr, lc)).Select
>
> Sheets("old").Select
> * * Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> CriteriaRange:= _
> * * * Sheets("new").Range(lr, lc), Unique:=False
>
> please help
> Thanks!
> Boss


 
Reply With Quote
 
Boss
Guest
Posts: n/a
 
      15th Dec 2008
Too good..

Defining range is something i thought but unable to code. Thanks for it..

Mean While i did something like this

Sub compare()
Sheets("new").Select
lr = Cells(65536, 1).End(xlUp).Row
lc = Range("IV1").End(xlToLeft).Column


Sheets("old").Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Range(Cells(1, 1), Cells(lr, lc)), Unique:=False

Sheets("old").Select
Range("a1").Select

End Sub

Thanks for your help
Boss

"(E-Mail Removed)" wrote:

> Hi
> Your criteria range
> Sheets("new").Range(lr, lc)
>
> is one cell.
> Do you mean
>
> Sheets("new").Select
> lr = Cells(65536, 1).End(xlUp).Row
> lc = Range("IV1").End(xlToLeft).Column
>
> With Sheets("new")
> 'note the dots. No need to select and it won't help
> Set CritRange = .Range(.Cells(1, 1), .Cells(lr, lc))
> end with
> Sheets("old").Select
> Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> CriteriaRange:= _
> Critrange, Unique:=False
>
> regards
> Paul
>
>
> On Dec 15, 12:00 pm, Boss <B...@discussions.microsoft.com> wrote:
> > Hi,
> >
> > what does this gives an error.
> >
> > Sub compare()
> > Sheets("new").Select
> > lr = Cells(65536, 1).End(xlUp).Row
> > lc = Range("IV1").End(xlToLeft).Column
> >
> > 'Range(Cells(1, 1), Cells(lr, lc)).Select
> >
> > Sheets("old").Select
> > Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> > CriteriaRange:= _
> > Sheets("new").Range(lr, lc), Unique:=False
> >
> > please help
> > Thanks!
> > Boss

>
>

 
Reply With Quote
 
Boss
Guest
Posts: n/a
 
      7th Jan 2009
Hi in huge data the macro is failing. cound you please hepl..

Thanks!
Boss

"Boss" wrote:

> Too good..
>
> Defining range is something i thought but unable to code. Thanks for it..
>
> Mean While i did something like this
>
> Sub compare()
> Sheets("new").Select
> lr = Cells(65536, 1).End(xlUp).Row
> lc = Range("IV1").End(xlToLeft).Column
>
>
> Sheets("old").Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> CriteriaRange:= _
> Range(Cells(1, 1), Cells(lr, lc)), Unique:=False
>
> Sheets("old").Select
> Range("a1").Select
>
> End Sub
>
> Thanks for your help
> Boss
>
> "(E-Mail Removed)" wrote:
>
> > Hi
> > Your criteria range
> > Sheets("new").Range(lr, lc)
> >
> > is one cell.
> > Do you mean
> >
> > Sheets("new").Select
> > lr = Cells(65536, 1).End(xlUp).Row
> > lc = Range("IV1").End(xlToLeft).Column
> >
> > With Sheets("new")
> > 'note the dots. No need to select and it won't help
> > Set CritRange = .Range(.Cells(1, 1), .Cells(lr, lc))
> > end with
> > Sheets("old").Select
> > Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> > CriteriaRange:= _
> > Critrange, Unique:=False
> >
> > regards
> > Paul
> >
> >
> > On Dec 15, 12:00 pm, Boss <B...@discussions.microsoft.com> wrote:
> > > Hi,
> > >
> > > what does this gives an error.
> > >
> > > Sub compare()
> > > Sheets("new").Select
> > > lr = Cells(65536, 1).End(xlUp).Row
> > > lc = Range("IV1").End(xlToLeft).Column
> > >
> > > 'Range(Cells(1, 1), Cells(lr, lc)).Select
> > >
> > > Sheets("old").Select
> > > Range("A11044").AdvancedFilter Action:=xlFilterInPlace,
> > > CriteriaRange:= _
> > > Sheets("new").Range(lr, lc), Unique:=False
> > >
> > > please help
> > > Thanks!
> > > Boss

> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with advanced filter macro DavidH56 Microsoft Excel Programming 8 3rd Jun 2009 12:24 AM
Advanced filter macro Boss Microsoft Excel Programming 3 11th Dec 2008 09:31 AM
Advanced Filter Macro Alex.W Microsoft Excel Misc 1 4th Apr 2008 12:19 PM
Advanced Filter Macro Dolphinv4 Microsoft Excel Misc 2 20th Mar 2008 11:42 AM
Using Advanced Filter through Macro =?Utf-8?B?UHJhc2hhbnQgR2FyZw==?= Microsoft Excel Programming 4 18th Dec 2004 01:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 AM.