Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing variables between a form and macro | New Users to Excel | |||
Passing variables between a form and macro | New Users to Excel | |||
Passing Variables to another macro | Excel Programming | |||
Passing variables from Outlook Macro to Excel Macro | Excel Programming | |||
passing variables from an excel macro to a powerpoint macro | Excel Programming |