Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Array Logic

  Asked By: Carolina    Date: Nov 08    Category: MS Office    Views: 796
  


I have 2 arrays (name ranged)... one is used as a flag (and is
text) the other is an array of integer values that flow through
calculations. I would like to write a code that looks at at flag to
see if it's on or off and, depending on that result, write a value into
the parallel value-array.

What's the best way to do this? I could probably get something crude
to work using active.cell offset type code, but there's got to be a
more efficient way to handle this. Any comments or suggestions would
be very much appreciated.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Alfie Evans     Answered On: Nov 08

to follow up on what I posted previously... this seems to work. I'm
still interested in what others are doing for this type  of problem
though....

Dim FlagArray As Range
Dim ValueArray As Range
Dim i As Long, j As Long

Set FlagArray = Range("FlagArray")
Set ValueArray = Range("ValueArray")

For i = 1 To FlagArray.Rows.Count
For j = 1 To FlagArray.Columns.Count

If FlagArray.Cells(i, j).Value = "X" Then
ValueArray.Cells(i, j).Value = 2

End If
Next j
Next i
End Sub

 
Didn't find what you were looking for? Find more on Array Logic Or get search suggestion and latest updates.




Tagged: