Thread: creating range
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default creating range

Try something like this.

Sub CRange()

Dim bigArray() As Integer
Dim midArray() As Integer
Dim bigCount, midCount As Integer

Range("A3").Select
Range(Selection, Selection.End(xlToRight)).Select

bigCount = 0
midCount = 0

For Each cell In Selection
If cell.Value 95 Then
ReDim Preserve bigArray(bigCount)
bigArray(bigCount) = cell.Value
bigCount = bigCount + 1
End If
If cell.Value <= 95 And cell.Value = 90 Then
ReDim Preserve midArray(midCount)
midArray(midCount) = cell.Value
midCount = midCount + 1
End If
Next cell

End Sub

Regards
Rowan


"toon" wrote:

hi!

i want to create a (dynamic) range in a row of sorted values

eg 99 97 97 97 96 95 94 91 90 89 ...

MyRange1 = all the cells 95
MyRange2= all the cells less than 95, greater than 90
Myrange3= ....

how do i manage?