View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Making a Matrix into a column.......

Try this macro! Adjust values for mrows and mcols to suit your matrix sizes!

Sub element6()
Dim c6 As Range
mrows = 3
mcols = 4
For melem = 1 To mrows
Range(Cells(melem, 1), Cells(melem, mcols)).Select
Selection.Copy
Cells((melem - 1) * mcols + 1, mcols + 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Next melem
Application.CutCopyMode = False
ccounter = 0
For Each c6 In Range(Cells(1, mcols + 1), Cells(mrows * mcols, mcols + 1))
If c6.Row Mod 6 = 0 Then
ccounter = ccounter + 1
Cells(ccounter, mcols + 2).Value = c6.Value
End If
Next c6
End Sub

Regards,
Stefi


€˛Alex Rauket€¯ ezt Ć*rta:

I have what seems to be an easy problem which I am unable to solve....

I have a matrix, lets say

A B C D
E F G H
I J K L

and I want to extrat every 6th element reading from left to right, i.e. F, L
etc.....

Any ideas? I though I could put the matrix into a vertical series, i.e.
A
B
C
D
etc....
and then choose every 6th number but I can't even get that far!!!!

Thanks for any help....