ForEach

Execute a procedure for each value of a list or number range.

Overloads

Overload Name Description
DataCache Execute a Procedure for each row in a DataCache.
NumberToNumber Execute a Procedure for each number of a specified range.
SqlDataCache (8.0) Execute a Procedure for each row in a DataCache created using AddDataCache.SQLPassthroughDataSet.
A workbook script property with the name of the column will be added for each column of the SqlDataCache as each row of the SqlDataCache is processed by the ForEach method.
If PropertyNamePrefix argument is specified then the name of each property added will be prepended with the PropertyNamePrefix like [PropertyNamePrefix][ColumnName].
The @PVal() function can be used within the specified Procedure to get the current value of this property.


DataCache

Execute a Procedure for each row in a DataCache.

Argument Description
SpecifySheetBy Select how to specify which worksheet to select while the method is being executed.
Specify one of the following values or an arbitrary value: <blank>SheetNameSheetNumberAllSheets
SheetSpec Specify the sheet-name or sheet-number, depending on SpecifySheetBy. If SpecifySheetBy is AllSheets then SheetSpec can be left empty.
Address The address of a range to select for the execution of the method.
CellByCell Whether to execute the method on a cell-by-cell basis, or on the range specified by the address.
ReverseOrder Whether to loop through the rows and columns from highest to lowest. Only applies when CellByCell is true.
MethodCondition If the result of method-condition expression resolves to FALSE, then the method is not executed.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
CellCondition If the result of the condition expression resolves to FALSE, then the current cell is skipped.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
DataCacheName The name of the data-cache that contains the values.
SortOrder (7.7) Specifies one or more columns of the DataCache to sort by.
Example: Col1
Example: Col1, Col3
Example: "Col2 DESC, Col1 ASC"
Procedure The name of the procedure to execute.
ExitLoopCondition Condition evaluated before each iteration of the ForEach loop. If the condition evaluates to True, the loop is exited.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
ColumnNumber The column number to get each value from. Use ColumnNumber in conjunction with PropertyName to produce a property with the value of the specified column number with each iteration of the ForEach.
PropertyName If PropertyName is specified, a script property will be added with the value specified by the ColumnNumber argument on each iteration of the ForEach loop with the specified name.
The @PVal() function can be used within the specified Procedure to get the current value of this property.

NumberToNumber

Execute a Procedure for each number of a specified range.

Argument Description
SpecifySheetBy Select how to specify which worksheet to select while the method is being executed.
Specify one of the following values or an arbitrary value: <blank>SheetNameSheetNumberAllSheets
SheetSpec Specify the sheet-name or sheet-number, depending on SpecifySheetBy. If SpecifySheetBy is AllSheets then SheetSpec can be left empty.
Address The address of a range to select for the execution of the method.
CellByCell Whether to execute the method on a cell-by-cell basis, or on the range specified by the address.
ReverseOrder Whether to loop through the rows and columns from highest to lowest. Only applies when CellByCell is true.
MethodCondition If the result of method-condition expression resolves to FALSE, then the method is not executed.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
CellCondition If the result of the condition expression resolves to FALSE, then the current cell is skipped.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
StartNumber The number to begin the ForEach with.
EndNumber The number to end the ForEach on.
Procedure The name of the procedure to execute.
ExitLoopCondition Condition evaluated before each iteration of the ForEach loop. If the condition evaluates to True, the loop is exited.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
PropertyName If PropertyName is specified, a script property will be added with the value specified by the ColumnNumber argument on each iteration of the ForEach loop with the specified name.
The @PVal() function can be used within the specified Procedure to get the current value of this property.

SqlDataCache (8.0)

Execute a Procedure for each row in a DataCache created using AddDataCache.SQLPassthroughDataSet.
A workbook script property with the name of the column will be added for each column of the SqlDataCache as each row of the SqlDataCache is processed by the ForEach method.
If PropertyNamePrefix argument is specified then the name of each property added will be prepended with the PropertyNamePrefix like [PropertyNamePrefix][ColumnName].
The @PVal() function can be used within the specified Procedure to get the current value of this property.

Argument Description
SpecifySheetBy Select how to specify which worksheet to select while the method is being executed.
Specify one of the following values or an arbitrary value: <blank>SheetNameSheetNumberAllSheets
SheetSpec Specify the sheet-name or sheet-number, depending on SpecifySheetBy. If SpecifySheetBy is AllSheets then SheetSpec can be left empty.
Address The address of a range to select for the execution of the method.
CellByCell Whether to execute the method on a cell-by-cell basis, or on the range specified by the address.
ReverseOrder Whether to loop through the rows and columns from highest to lowest. Only applies when CellByCell is true.
MethodCondition If the result of method-condition expression resolves to FALSE, then the method is not executed.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
CellCondition If the result of the condition expression resolves to FALSE, then the current cell is skipped.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
DataCacheName The name of the data-cache that contains the values.
SortOrder Specifies one or more columns of the DataCache to sort by.
Example: Col1
Example: Col1, Col3
Example: "Col2 DESC, Col1 ASC"
Procedure The name of the procedure to execute.
ExitLoopCondition Condition evaluated before each iteration of the ForEach loop. If the condition evaluates to True, the loop is exited.
Specify one of the following values or an arbitrary value: <blank>FALSETRUE
PropertyNamePrefix If PropertyNamePrefix is specified the name of each workbook script property will be prepended with the prefix like [PropertyNamePrefix][ColumnName].
The @PVal() function can be used within the specified Procedure to get the current value of this property.