Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Next Line in Auto Filter Macro

Hi

I have a macro which I use so seperate 300 branches data from one master
file into 300 branch files. I have a Macro which copies the filtered sheet,
pastes it onto a new workbook, then saves as "contents of cell b6".xls

I run this macro 300 times from this piece of code:-

Selection.AutoFilter Field:=2, Criteria1:="Branch1"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch2"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch3"
Application.Run "FERDRUN"
etc etc


When new braches are added, I have to edit the code or the new brach will be
missed.

I'd rather just have a single piece of code which steps to the next line in
the auto filter, rather than 300 lines of the above.

I this possible ?

--
Rich
http://www.richdavies.com/excel.htm
http://www.richdavies.com/fantasy-football.htm


** Posted from http://www.teranews.com **
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Next Line in Auto Filter Macro

Hi

See for instance http://www.ozgrid.com/forum/showthread.php?t=72736

And also the link in my second post in that topic.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Rich" wrote:

Hi

I have a macro which I use so seperate 300 branches data from one master
file into 300 branch files. I have a Macro which copies the filtered sheet,
pastes it onto a new workbook, then saves as "contents of cell b6".xls

I run this macro 300 times from this piece of code:-

Selection.AutoFilter Field:=2, Criteria1:="Branch1"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch2"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch3"
Application.Run "FERDRUN"
etc etc


When new braches are added, I have to edit the code or the new brach will be
missed.

I'd rather just have a single piece of code which steps to the next line in
the auto filter, rather than 300 lines of the above.

I this possible ?

--
Rich
http://www.richdavies.com/excel.htm
http://www.richdavies.com/fantasy-football.htm


** Posted from http://www.teranews.com **

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Next Line in Auto Filter Macro

I'd look at these techniques:

Ron de Bruin's EasyFilter addin:
http://www.rondebruin.nl/easyfilter.htm

Code from Debra Dalgleish's site:
http://www.contextures.com/excelfiles.html

Create New Sheets from Filtered List -- uses an Advanced Filter to create
separate sheet of orders for each sales rep visible in a filtered list; macro
automates the filter. AdvFilterRepFiltered.xls 35 kb

Update Sheets from Master -- uses an Advanced Filter to send data from
Master sheet to individual worksheets -- replaces old data with current.
AdvFilterCity.xls 55 kb

Rich wrote:

Hi

I have a macro which I use so seperate 300 branches data from one master
file into 300 branch files. I have a Macro which copies the filtered sheet,
pastes it onto a new workbook, then saves as "contents of cell b6".xls

I run this macro 300 times from this piece of code:-

Selection.AutoFilter Field:=2, Criteria1:="Branch1"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch2"
Application.Run "FERDRUN"

Selection.AutoFilter Field:=2, Criteria1:="Branch3"
Application.Run "FERDRUN"
etc etc

When new braches are added, I have to edit the code or the new brach will be
missed.

I'd rather just have a single piece of code which steps to the next line in
the auto filter, rather than 300 lines of the above.

I this possible ?

--
Rich
http://www.richdavies.com/excel.htm
http://www.richdavies.com/fantasy-football.htm

** Posted from http://www.teranews.com **


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-Filter within a Macro jeannie v Excel Discussion (Misc queries) 1 June 17th 07 10:59 AM
auto filter macro Larry Excel Programming 2 April 7th 07 02:38 AM
Auto Filter Macro Snakeoids Excel Discussion (Misc queries) 10 August 24th 05 08:46 PM
Auto filter macro Ali[_3_] Excel Programming 3 December 12th 03 02:05 PM
Auto Filter in a macro hawkeyes2002[_2_] Excel Programming 0 November 14th 03 11:41 PM


All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"