VBA Filter (with many variables) and copy result to new Worksheets

Using XL 2003 and 97

Two columns (fields) to be used to filter

For Data set #1:

ColumnA
Division
(Choices)        
   A
   B         
   C

ColumnB
  Emp#
(Choices are numbers and ALL need to be considered at once)
From 4142 to 4143
From 4500 to 5001
From 4509 to 4512
From 6000 to 7000
4122, 4125, 4161, 4177
4803

I do know how to VBA-code a two column (field) filter.

That said, how do I handle the multiple ColumnB possibilities?  In reality, 
there are 23 more Emp#'s than I listed above.

I know that there is a limit (7?) to variables includible in the AND and OR 
functions.

There are ten sets of filters like the one above.

After each VBA filter (10 sets) is run, I would like to copy the filtered 
data set to a series of new worksheets like:

Data #1
Data #2, etc.

Any help would be greatly appreciated.

TIA

Dennis
0
Dennis (299)
10/23/2004 5:01:02 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
461 Views

Similar Articles

[PageSpeed] 32

Set up the criteria area with a blank heading cell, and two heading 
cells with "Emp#"

Assuming your first division is in cell C2, enter the following formula 
in the cell below the blank criteria heading:

   =OR(C2="A",C2="B",C2="C")

Under the first Emp# heading, enter:  >=4142
Under the second Emp# heading, enter:  <=4143

Copy the formula exactly into the next criteria row (don't drag it down 
to copy, or the cell reference will change)
For the Emp# enter the next range of numbers
Continue for all the ranges of Emp#s

To extract the results to a new sheet, start the Advanced filter from 
the new sheet. There are instructions here:

   http://www.contextures.com/xladvfilter01.html


Dennis wrote:
> Using XL 2003 and 97
> 
> Two columns (fields) to be used to filter
> 
> For Data set #1:
> 
> ColumnA
> Division
> (Choices)        
>    A
>    B         
>    C
> 
> ColumnB
>   Emp#
> (Choices are numbers and ALL need to be considered at once)
> From 4142 to 4143
> From 4500 to 5001
> From 4509 to 4512
> From 6000 to 7000
> 4122, 4125, 4161, 4177
> 4803
> 
> I do know how to VBA-code a two column (field) filter.
> 
> That said, how do I handle the multiple ColumnB possibilities?  In reality, 
> there are 23 more Emp#'s than I listed above.
> 
> I know that there is a limit (7?) to variables includible in the AND and OR 
> functions.
> 
> There are ten sets of filters like the one above.
> 
> After each VBA filter (10 sets) is run, I would like to copy the filtered 
> data set to a series of new worksheets like:
> 
> Data #1
> Data #2, etc.
> 
> Any help would be greatly appreciated.
> 
> TIA
> 
> Dennis


-- 
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

0
dsd1 (5911)
10/23/2004 11:04:30 PM
Reply:

Similar Artilces:

VBA code to say Yes or No if any VBA code is present in ActiveWork
Using XL 2003 & 97 Would like hit Ctrl+Shift+V and have an answer either yes or no as to the presence of Any VBA code in the Active Workbook. I do know that about the VBA editor/Explorer or to press the Run Macro button and get a list from various sources . I would like to stay at the keyboard and process a series of macros including one to let me know if I even need to evoke the VBA explorer. TIA Dennis There is no bootstrap macro to tell you whether you have macros or not. If there were there would be no limit to virus writers. --- HTH, David McRitchie, Microsoft MVP - Excel ...

Automatically copy cell above
Does anyone know how to automatically copy cell above the current cell? I have a long list of employees with account numbers. However, I want to only include employees with 6-xxxxx account numbers. Having blank cells on some of rows with account numbers, I may pull 6-xxxxx account numbers without names after sorting the cells by account numbers. Here is how my spreadsheet looks like: ABDULLAH,MALIK 6-63027-1200 ABROKWA,JOE 2-11932-1100 2-11932-2000 2-11987-1010 2-11987-2000 ACTON,LATOYA 6-63027-1200 ACTON,LYNETTE 2-24001-1400 ...

How to copy Comapnyweb from Svr2003 w MSDE to Svr 2003R2 w SQL2005
How can I copy companyweb from (source) Microsoft SBS 2003 Premium other then English Microsoft Windows SharePoint Services 2.0 (6.0.2.8117) with MSDE to (destination) Microsoft SBS 2003 R2 Premium English Microsoft Windows SharePoint Services 2.0 (6.0.2.6411) with SQL2005 Source server and destination server are in separeted network with no access to internet. Thanks in advance. ...

Print, Merged Cells, and VBA
Hello I'm looking for a code that will help me with a print job for a worksheet. There are a lot of merged cells and a lot of "IF"s to be used in the VBA for range selection. Thanks in advance, Sarr ...

Backup cannot copy .pst files
When I exit Outlook and click on Save Backup. I get the error "Cannot copy Outlook: The process cannot access the file beause another process has locked a portion of the file" Please advise with how to fix this problem. ...

Use VBA to update Access table or Query from Excel
Can I use VBA to update Access table or Query from Excel? Thanks in advance Hi Leungkong, > Can I use VBA to update Access table or Query from Excel? Of course, using ADO or DAO. See: http://www.erlandsendata.no/english/index.php?d=envbadacexportado Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Hi Jan, Thanks. I think ADO is what I want. But I am not only want to export from excel to access. I want to edit some data in access table. For example, Access has a table "ProductList" I want to use Excel to call the product by "Pro...

copy,paste and loop through workbook
I am looking for a macro,Match sheet2 name value from sheet1! a:a list,copy those matching row values(sheet1!B:f) and paste them to relevant sheet's last empty row(sheet2! a(row#):e(row#)),thus loop through every sheet from sheet2 to end sheet of workbook. ...

Worksheet tabs disappearing
Hi Group, I have an Excel 2000 workbook which I am getting reports of worksheets missing. The workbook has custom menus and the delete worksheet option is not available and the right mouse tab menus are disabled. Can a worksheet be deleted or dragged out of a workbook by error? Any light on this would be great Regards Don Sometimes when you hide and unhide worksheets by macro the tabs of the newly unhidden sheets are to the left of the first visible tab. People often don't think to scroll the sheet tabs to the left to find them. -- Jim "donh" <donhartuk@gmail.com&g...

VBA and Scheduled task in Outlook
Hi, how can I: a) pull the query from somewhere and send it by e-mail automatically. E.g. I want to take a temperature table from http://www.wunderground.com/history/airport/EHAM/2009/7/10/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA where 2009/7/10 is the date of yesterday put it into an e-mail and send it automatically each day at 8 o'clock? b) if this is not possible, how can I send an e-mail with the attachment c:\Documents\query20090710.xls each day at 8 o'clock? my boss wants this automatized, I know how to write the VBA code for Excel, but don'...

New G5 tower has problem opening Word 2004
I have a brand new G5 running OSX 10.4.10. I have installed Office 2004, and am having trouble launching Word. After double clicking, it opens a blank window and then freezes as it works it way through the "optomizing font performance" bar at the bottom of the window. <br><br>It starts to give me a warning box for one font after another that says "This font is corrupt and should be removed." I believe, however, that Word itself it installing the fonts in Font Book just before it determines they are corrupt. Wierd. <br><br> It has taken me over 1/2 ho...

vba select field
Hi, having a button on a form, is it possible to select only some fields (all from the same table) of the current record instead of all fields? I've tried this code: RunCommand acCmdSelectRecord RunCommand acCmdCopy Forse dipende dei dati nel record. but it selects ALL fields in the form. Thank you. Remigio hi, On 10.04.2010 18:01, remigio wrote: > having a button on a form, is it possible to select only some fields > (all from the same table) of the current record instead of all fields? > I've tried this code: > > RunCommand acCmdSelectRecord &...

Restoring Exchange Store files to a new server
We had a major system crash this week but I was able to grab the entire exchsrv directory from the server. What files do I need to copy to the new server to get all of my exchange mail/public folders/etc loaded on the new server? Thanks, CJ What version of Exchange? -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "Curious Joe" <joebob.johnson@gmail.com> wrote in message news:1160176822.798021.310710@m73g2000cwd.googlegroups.com... > We had a major system crash this week but I was able to grab the entire > exchsrv director...

2007 search not working with Vista with new profile
It stopped working after I deleted my mail profile and started from scratch again. Who would have guessed doing that would break the search feature? I thought maybe it was indexing, but this is even after indexing has finished. Take any word from any subject line in any message and put that same word into the search box and it doesn't find the message. Using Vista with Outlook 2007 with Exchange 2003. Also the desktop search no longer looks inside my emails. Any ideas? Is there a cheat to make Outlook 2007 use the old simple search feature we love/hate from Outlook 2003 and befor...

Mailbox not created when new user added
I know I read something about this issue lately, but I can't put my finger on it. I have a Windows 2003 SBS. When I created my user accounts, the properties in ADUC reports the mailbox exists in [servername]/First Storage Group/Mailbox Store[servername]. But the only boxes that show up in Exchange Manager are Administrator, SMTP (servername), System Attendant, and SystemMailbox. I don't have many users, so manually creating them is not a big deal. But I'd like to know what the best practice method is under these circumstances. Exchange Details: Version 6.5, Build 694...

VLOOKUP in VBA
On the worksheet I can insert in a cell =VLOOKUP(C5, Hobokee.xls!AcsLow, 2) and it works perfectly, looks up the value in column 2 of the range named AcsLow in the same workbook. But elswhere I want in a macro to lookup the same table and assign the result to a variable BalAmt. BalAmt = VLOOKUP(AccNum, Hobokee.xls!AcsLow, 2) does not work. It gives a function not defined error on Hobokee. If instead of Hobokee I put Workbooks("Hobokee"), it gives function not defined error for VLOOKUP which it changes to VLookup. I have been overVLOOKUP in the Help file and see nothing wrong. W...

Excel VBA/Macro programming for beginners
Hi all, I know a bit VB 6.0 programming. Will it help me to write exce vba/macro(same thing?).can anybody help me by providing some fre websites where i can have informations/codes for VBA/macro. Please tell me how could i make a *command Button * in a cell in th excel sheet -- sdebu_200 ----------------------------------------------------------------------- sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=430 View this thread: http://www.officehelp.in/showthread.php?t=118812 Posted from - http://www.officehelp.i Try David McRitchie's "getting started with mac...

Turn pc speaker on/off with vba code
Is this possible? Thanks I found something here on how to do it withVBScript. You can probably modify it to work in VBA http://www.pcreview.co.uk/forums/thread-1468591.php -- HTH, Barb Reinhardt "David" wrote: > Is this possible? > Thanks Thanks Barb I'll have a go (I need to improve my web searching skills) "Barb Reinhardt" wrote: > I found something here on how to do it withVBScript. You can probably modify > it to work in VBA > > http://www.pcreview.co.uk/forums/thread-1468591.php > -- > HTH, > ...

Hiding/Unhiding worksheets
Hi, I want to hide several sheets in a workbook yet have one of them unable to be unhidden. Is there any way I can make is so that a worksheet cannot be viewed without a password? Thanks in advance. Tools|Protection|Protect workbook Check the Structure box But be aware that the password you supply is very simple to break. If you have data you really don't want others to see, excel ain't the application for you. nikki8327 wrote: > > Hi, > I want to hide several sheets in a workbook yet have one of them unable to > be unhidden. Is there any way I can make is so tha...

move project server databases to new instance
are the step by step instructions on moving project server databases to a new instance? Tried the link before but I could not bring up the configuration wizard to remove the server farm. http://lkar.blogspot.com/2008/05/moving-moss-project-server-2007.html Hi will, Maybe this will assist: http://blogs.msdn.com/brismith/archive/2008/09/20/project-server-2007-moving-a-copy-of-production-to-test-part-1.aspx "will" wrote: > are the step by step instructions on moving project server databases to a new > instance? > > Tried the link before but I co...

Loading a Form from VBA
Hi all, I'd like a module to open and load a form in my Access 2003 database... How can I do this? Use the OpenForm method. Look in the Help file for details. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Mike" <michael.leon.schwartz@gmail.com> wrote in message news:1184770076.109526.207900@o11g2000prd.googlegroups.com... > Hi all, I'd like a module to open and load a form in my Access 2003 > database... How can I do this? > On Jul 18, 10:58 am, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com&g...

Excel and VBA
I am very interested in learning more about using VBA in office, especially Excel. Can you post some resources (online, books, etc) that can be used to help learn about using Visual Basic in office. Thanks! Here's a good place to start: http://www.contextures.com/xlbooks.html Does that help? *********** Regards, Ron XL2002, WinXP "Bob Sinclair" wrote: > I am very interested in learning more about using VBA in office, especially > Excel. Can you post some resources (online, books, etc) that can be used to > help learn about using Visual Basic in office. >...

Getting the result on the basis of date
hi,I have query which is based on a table with employee daily activities.I want to extract the report on the basis of date. I included thefollowing parameter [enter_date] - date/time format and in criteria igave [date]. however when i run the query its giving the entire dateand not the date which i enter in the input box. Can anyone help mehow to solve this problem?Regards,Karthik...

VBA Customization
Is there a way to get the name of the current company through VBA in Great Plains 8.0? Thanks for all your help. open GreatPlains. Add the current window, it will add the Toolbar then add fields choose the company name on the top left after the user id. >-----Original Message----- >Is there a way to get the name of the current company through VBA in Great >Plains 8.0? > >Thanks for all your help. > > > >. > Thanks. I tried, but I couldn't add company name to the field list. It opens up the login screen instead. Any thoughts? Thanks again. "ger...

Tables in excel- bringing down formulas for new records.
I am trying to put together a table and want to have an auto number that counts the recods and puts the next number in for a new record. Need a good method to do this and to have it automatically carried down when a new record is created. I also have a formula that calculates interest on a principle amount. Neither formula will come down when a new record is created. Thanks. Sun, 16 May 2010 10:58:01 -0700 from Ben <Ben@discussions.microsoft.com>: > > I am trying to put together a table and want to have an auto number that > counts the recods and puts the...

Run VBA without show
I want excel to run the VBA code without showing me what it is doing. Which code should i use for that? Sub RunWithoutShow() Application.ScreenUpdating = False 'Paste the vba code here 'end of code 'Change screenupdating property to true Application.ScreenUpdating = True End Sub I hope this helps... Selva V Pasupathy For more on Excel, VBA, & other Resources Please visit: http://socko.wordpress.com You may also (inserting into quote from code example bellow from Socko) Use Application.Visible property to hide the application entirely Sub RunWithoutShow() Appli...