LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
IAM IAM is offline
external usenet poster
 
Posts: 3
Default Looping and passing variables to a macro etc.


I have a macro that filters a list and then copies the filtered results to a
new page. I would love to have the macro keep running based on a specific
variable passed directly from a list of values on a sheet in the workbook.

Here is the basic macro I have now:
______++++++++++++++++______________
Application.Goto Reference:="SelectHeader"
ActiveSheet.Range("$A$5:$CW$355").AutoFilter Field:=77, Criteria1:="0350"
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Cells.Select
Cells.EntireColumn.AutoFit
______++++++++++++++++______________

I want to do a few things.

1. the criteria for the sort: I want to pass this as a variable from a cell
on a worksheet.

2. I want to loop this macro until it goes through all of the values in a
range for the Criteria1 until it finds and empty cell. e.g. I have 25
territories that need their own workbook so I want the macro to go through an
create workbooks for all 25 territories and then stop.

3. I want to name the new workbooks using the same variable passed in for
the sort criteria + some standard text. e.g. Territory_0350.xls

Thanks,

Iam
 
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
Passing variables between a form and macro David New Users to Excel 1 October 5th 05 04:42 AM
Passing variables between a form and macro David New Users to Excel 4 September 23rd 05 11:57 AM
Passing Variables to another macro Jeff Excel Programming 3 January 16th 05 03:41 AM
Passing variables from Outlook Macro to Excel Macro [email protected] Excel Programming 2 January 7th 05 10:07 PM
passing variables from an excel macro to a powerpoint macro jake Excel Programming 1 December 11th 03 02:36 AM


All times are GMT +1. The time now is 12:27 PM.

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"