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: 10
Default Looping Help Required

I am trying to write a macro for excel where i need to copy data from one
worksheet to another based upon a filtered result from the sheet which has
data. The macro should repeat the filter criteria with changed setting and
paste into different cells. To make myself more clear I am pasting 3
instances of the macro I need for the loop.

'Selects Cell A2 in the blank sheet (this cell will change everytime by
20, because there can be max of 20 results from the filter
criteria)
Range("A2").Select
Sheets("Unarranged Data").Select
Application.CutCopyMode = False
'Criteria1 changes everytime from 1:1 to 1:40, then 2:1 to 2:40, then
3:1 to 3:40 and so on till 9:1 to 9:40
Selection.AutoFilter Field:=6, Criteria1:="1:1"
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Arranged Data1").Select
ActiveSheet.Paste

I need to know whether a loop for this kind of thing can be made if so
please help, otherwise do I need to write the code 360 times or what?
 
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
Looping...but why? cherrynich Excel Programming 2 May 12th 06 04:57 PM
Looping Buffyslay Excel Programming 1 February 1st 06 05:57 PM
Looping scottwilsonx[_54_] Excel Programming 0 October 5th 04 04:29 PM
Looping Andrew Clark[_2_] Excel Programming 1 December 20th 03 05:01 PM
Need Looping Help [email protected] Excel Programming 2 October 29th 03 08:11 PM


All times are GMT +1. The time now is 04:20 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"