LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Difficult Looping Macro€¦with AutoFilter

This is kind of difficult to explain, but here goes. Below I have a loop
(code is below) that filters items in AA1:AA11 and copies pastes the results
into A3:A6, and loops through all items in the list of names in AA and it
even assigns the persons name to the Worksheet tab. It is actually very
nice, and I tip my hat to Joel for putting this together for me!!

Now, the requirements have changed a bit and Id like to know if the
following is possible€¦ Is there a way to modify this macro to apply the
AutoFilter to ColumnAA, copy/paste the name into Range A3:A6 (this will
always be the same), then turn off the filter, move to ColumnAB, apply the
filter, and filter names in AB (these are the same names), and then copy the
resulting items in AB:AC, and paste these in A11:B15 (copied down five
times), then skip a row, and then go back to AB and get the next names in AB
and the adjacent AC, and copy/paste these into lets say A17:B17 (remember
A11:B11, then copied down 5 then skip a row). After Excel gets to the end of
the list in AB (which is variable and always of different length) I would
need it to turn off the filter in AB:AC and go to AD:AF and again apply the
filter and copy/paste names in AD:AF and do the same as above, starting in
the first unused cell in Column A (at this point I dont know how far down I
will be in ColumnA). I know this is asking a heck of a lot. The looping
stuff has always been tricky for me. Ive been working on this since early
this morning. Ive tried many things in Access and Excel too (of course).
Although it is very complex, I think this is the best, and most feasible,
solution. However, if someone has a better solution I am open to
suggestions!! Anyway, if someone here understands my need, PLEASE post back
with what you think would be a solution, and Ill try to make some
modifications if it doesnt work, and together, hopefully, we can get this
thing working.


Sub SheetsRVP()

With Sheets("RVP")
lstRw = .Cells(Rows.Count, "AA").End(xlUp).Row

For Each C In .Range("AA1:AA11")

C.Copy
..Range("A3:A6").PasteSpecial Paste:=xlPasteValues

Set newsht = Sheets.Add(after:=Sheets(Sheets.Count))

..Range("A1:O17").Copy _
Destination:=newsht.Range("A1")
newsht.Cells.Columns.AutoFit
Columns("K:K").Select
Selection.ColumnWidth = 20
Range("A1").Select
newsht.Name = "RVP - " & C
Next C

End With

End Sub

Regards,
Ryan---


--
RyGuy
 
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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
AutoFilter, Looping through the Rows? (Newbie) Barton[_2_] Excel Programming 3 April 12th 05 07:51 PM


All times are GMT +1. The time now is 01:34 AM.

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

About Us

"It's about Microsoft Excel"