View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Barlow Tim Barlow is offline
external usenet poster
 
Posts: 34
Default Insert row for each different value in a vector

Alex,

I'm not sure what your trying to do, but try this:


Dim C As New Collection
Dim Ndx As Long
Dim i As Integer

For Ndx = 3 To 100
C.Add Cells(Ndx, 2).Value 'Range("B3:B100") is my vector
Next Ndx

For i = 1 To C.Count
Rows("1").Insert
Range("A1").Value = C(i)
Next i

HTH

Tim


"Alex St-Pierre" wrote in message
...
I have a column B which contains an indicator like AB, AC, AD, AC AA, etc.
In the firsts column, I want to add line with the different value in cell
"A1" (for each different indicator). I tried this but doesn't word.

Dim C As New Collection
Dim Ndx As Long
On Error Resume Next
For Ndx = 1 To 98
C.Add Range("B3:B100"), Range("B3:B100") 'Range("B3:B100") is my

vector
Next Ndx
For i = 1 to C.Count
rows("1:1").insert
sheets("A1").value = C.value(i)
next i


--
Alex St-Pierre