View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mvyvoda mvyvoda is offline
external usenet poster
 
Posts: 41
Default For Each Array Question

Greeting,

I'm trying to use an array to complete a task. The following code is what I
have thus far, but get an error on the 2nd line (OSRCount is the array). I
need to make this loop work for each item in the arraym but don't really know
how to do that.

-----Function--------------------------
For Each OSRCount In OSRList
Do While RowEnd < RowEnd + (2 * OSRCount / 3)
Range(Cells(RowStart, ColumnStart), Cells(RowEnd, ColumnStart +
2)).Select
Selection.Cut
Range(Cells(RowStart - OSRCount / 3, ColumnStart + 5),
Cells(RowStart - OSRCount / 3, ColumnStart + 5)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
RowStart = RowStart + Round(2 * (OSRCount / 3))
RowEnd = RowEnd + Round(2 * (OSRCount / 3))
ColumnStart = ColumnStart + 4
Exit For
Loop
Next
------- Definition of Array --------------------------------
OSRList = Array("BS", "CK", "HS", "IT", "JD", "JW", "KC", "KF", "MG",
"MM", "SM", "TS", "VD")
For Each OSRCount In OSRList
OSRCount = Application.CountIf(Sheets("ALLACCT").Range("B:B") ,
OSRList)
Exit For
Next
--------------------------------

Any help would be really appreciated!,
-m