PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Discussion Automatic unique records filter macro

Reply

Automatic unique records filter macro

 
Thread Tools Rate Thread
Old 09-07-2008, 06:07 AM   #1
gferrer010@gmail.com
Guest
 
Posts: n/a
Default Automatic unique records filter macro


I continuously update a database - it has multiple columns - and have
assigned a dynamic range name to it ("List"). Since the database has
some duplicate records, very often I end up performing the Data/
Filter/Advanced Filter routine and copying the unique records onto
another sheet (same workbook).

Would it be possible to automate this command? Is there a macro that
would copy the unique records to another sheet automatically, while
the workbook is open, without having to push a command button, or
opening/closing the file? Thanks in advance.

Regards,
George Ferrer
  Reply With Quote
Old 09-07-2008, 01:57 PM   #2
Dave Peterson
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

I would create my own macro.

I'd start by recording a macro when I did all the work manually.

gferrer010@gmail.com wrote:
>
> I continuously update a database - it has multiple columns - and have
> assigned a dynamic range name to it ("List"). Since the database has
> some duplicate records, very often I end up performing the Data/
> Filter/Advanced Filter routine and copying the unique records onto
> another sheet (same workbook).
>
> Would it be possible to automate this command? Is there a macro that
> would copy the unique records to another sheet automatically, while
> the workbook is open, without having to push a command button, or
> opening/closing the file? Thanks in advance.
>
> Regards,
> George Ferrer


--

Dave Peterson
  Reply With Quote
Old 09-07-2008, 08:34 PM   #3
gferrer010@gmail.com
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

On Jul 9, 4:57*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> I would create my own macro.
>
> I'd start by recording a macro when I did all the work manually.
>
> gferrer...@gmail.com wrote:
>
> > I continuously update a database - it has multiple columns - and have
> > assigned a dynamic range name to it ("List"). Since the database has
> > some duplicate records, very often I end up performing the * Data/
> > Filter/Advanced Filter routine and copying the unique records onto
> > another sheet (same workbook).

>
> > Would it be possible to automate this command? Is there a macro that
> > would copy the unique records to another sheet automatically, while
> > the workbook is open, without having to push a command button, or
> > opening/closing the file? Thanks in advance.

>
> > Regards,
> > George Ferrer

>
> --
>
> Dave Peterson


Dave,

If I record a a macro I still have to use the command/radio buttons in
order to execute the macro though. If possible, I'd rather avoid
that. The reason being that another person is going to take over the
maintenance of this database and he doesn't even know the basics of
Excel.
I'm not even sure if the automation of this task is possible. Is there
a VBA code that would do this?

Thanks,
George
  Reply With Quote
Old 09-07-2008, 09:20 PM   #4
Dave Peterson
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

The recorded code won't show the dialogs for you to chose options. It'll just
use the options that you used when you recorded the macro.

Try recording the macro and see if it gets close to what you want. If you have
trouble tweaking it, post back with your macro and what tweaks you need.

gferrer010@gmail.com wrote:
>
> On Jul 9, 4:57 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > I would create my own macro.
> >
> > I'd start by recording a macro when I did all the work manually.
> >
> > gferrer...@gmail.com wrote:
> >
> > > I continuously update a database - it has multiple columns - and have
> > > assigned a dynamic range name to it ("List"). Since the database has
> > > some duplicate records, very often I end up performing the Data/
> > > Filter/Advanced Filter routine and copying the unique records onto
> > > another sheet (same workbook).

> >
> > > Would it be possible to automate this command? Is there a macro that
> > > would copy the unique records to another sheet automatically, while
> > > the workbook is open, without having to push a command button, or
> > > opening/closing the file? Thanks in advance.

> >
> > > Regards,
> > > George Ferrer

> >
> > --
> >
> > Dave Peterson

>
> Dave,
>
> If I record a a macro I still have to use the command/radio buttons in
> order to execute the macro though. If possible, I'd rather avoid
> that. The reason being that another person is going to take over the
> maintenance of this database and he doesn't even know the basics of
> Excel.
> I'm not even sure if the automation of this task is possible. Is there
> a VBA code that would do this?
>
> Thanks,
> George


--

Dave Peterson
  Reply With Quote
Old 09-07-2008, 10:32 PM   #5
gferrer010@gmail.com
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

On Jul 9, 12:20*pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> The recorded code won't show the dialogs for you to chose options. *It'll just
> use the options that you used when you recorded the macro.
>
> Try recording the macro and see if it gets close to what you want. *If you have
> trouble tweaking it, post back with your macro and what tweaks you need.
>
>
>
>
>
> gferrer...@gmail.com wrote:
>
> > On Jul 9, 4:57 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > I would create my own macro.

>
> > > I'd start by recording a macro when I did all the work manually.

>
> > > gferrer...@gmail.com wrote:

>
> > > > I continuously update a database - it has multiple columns - and have
> > > > assigned a dynamic range name to it ("List"). Since the database has
> > > > some duplicate records, very often I end up performing the * Data/
> > > > Filter/Advanced Filter routine and copying the unique records onto
> > > > another sheet (same workbook).

>
> > > > Would it be possible to automate this command? Is there a macro that
> > > > would copy the unique records to another sheet automatically, while
> > > > the workbook is open, without having to push a command button, or
> > > > opening/closing the file? Thanks in advance.

>
> > > > Regards,
> > > > George Ferrer

>
> > > --

>
> > > Dave Peterson

>
> > Dave,

>
> > If I record a a macro I still have to use the command/radio buttons in
> > order to execute the macro though. If possible, I'd *rather avoid
> > that. The reason being that another person is going to take over the
> > maintenance of this database and he doesn't even know the basics of
> > Excel.
> > I'm not even sure if the automation of this task is possible. Is there
> > a VBA code that would do this?

>
> > Thanks,
> > George

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -




Dave, here is the macro that I came up with:

Sub ExtractUniqueRecords()

Keyboard Shortcut: Ctrl+z

Range("List”).AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"A2"), Unique:=True

End Sub

This seems to work OK, but I either have to use the keyboard shortcut
or assign a button in order to run it. It's not capable of running by
itself, without any (manual) commands.
  Reply With Quote
Old 09-07-2008, 11:29 PM   #6
Dave Peterson
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

That seems pretty reasonable to me.

Why and when would you want it to run automatically?



gferrer010@gmail.com wrote:
>

<<snipped>>
>
> Dave, here is the macro that I came up with:
>
> Sub ExtractUniqueRecords()
>
> Keyboard Shortcut: Ctrl+z
>
> Range("List”).AdvancedFilter Action:=xlFilterCopy,
> CopyToRange:=Range( _
> "A2"), Unique:=True
>
> End Sub
>
> This seems to work OK, but I either have to use the keyboard shortcut
> or assign a button in order to run it. It's not capable of running by
> itself, without any (manual) commands.


--

Dave Peterson
  Reply With Quote
Old 10-07-2008, 06:06 AM   #7
gferrer010@gmail.com
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

On Jul 9, 2:29*pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> That seems pretty reasonable to me. *
>
> Why and when would you want it to run automatically?
>
>
>
>
>
>
>
> gferrer...@gmail.com wrote:
>
> <<snipped>>
>
> > Dave, here is the macro that I came up with:

>
> > Sub ExtractUniqueRecords()

>
> > *Keyboard Shortcut: Ctrl+z

>
> > *Range("List”).AdvancedFilter Action:=xlFilterCopy,
> > CopyToRange:=Range( _
> > * * "A2"), Unique:=True

>
> > End Sub

>
> > This seems to work OK, but I either have to use the keyboard shortcut
> > or assign a button in order to run it. It's not capable of running by
> > itself, without any (manual) commands.

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -



I just want to eliminate any potential mistakes, since the person
who's gonna be doing the data entry is rather mistake prone, and is
most likely going to forget to use the macro command. Automating the
whole thing whould eliminate lots of duplication errors. Ideally the
macro would run by itself as soon as new pieces of data/records are
added to the database.




  Reply With Quote
Old 10-07-2008, 01:19 PM   #8
Dave Peterson
Guest
 
Posts: n/a
Default Re: Automatic unique records filter macro

Personally, I wouldn't do it that way.

If your database has 18 fields, you'd choose one to indicate that you're done
with the data entry (the 18th field???). Then if the user notices a typo, your
automatic filter may have hidden the row and it may be difficult to find. Or if
the user just starts entering data in your indicator field, it could be a
problem for the user.

But if you wanted, you could use an event macro (worksheet_change) that would
look for changes in certain ranges and run your routine.

But I don't know enough to offer any real details.

gferrer010@gmail.com wrote:
>
> On Jul 9, 2:29 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > That seems pretty reasonable to me.
> >
> > Why and when would you want it to run automatically?
> >
> >
> >
> >
> >
> >
> >
> > gferrer...@gmail.com wrote:
> >
> > <<snipped>>
> >
> > > Dave, here is the macro that I came up with:

> >
> > > Sub ExtractUniqueRecords()

> >
> > > Keyboard Shortcut: Ctrl+z

> >
> > > Range("List”).AdvancedFilter Action:=xlFilterCopy,
> > > CopyToRange:=Range( _
> > > "A2"), Unique:=True

> >
> > > End Sub

> >
> > > This seems to work OK, but I either have to use the keyboard shortcut
> > > or assign a button in order to run it. It's not capable of running by
> > > itself, without any (manual) commands.

> >
> > --
> >
> > Dave Peterson- Hide quoted text -
> >
> > - Show quoted text -

>
> I just want to eliminate any potential mistakes, since the person
> who's gonna be doing the data entry is rather mistake prone, and is
> most likely going to forget to use the macro command. Automating the
> whole thing whould eliminate lots of duplication errors. Ideally the
> macro would run by itself as soon as new pieces of data/records are
> added to the database.


--

Dave Peterson
  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off