Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Changing a matrix into one large column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeroen2 - 26 Jan 2006 15:58 GMT
Hi,

Does anyone know how to change a large matrix into one column?

Like this:

abc
abc
abc

into

a
a
a
b
b
b
c
c
c

I am not being to able to solve this puzzle

Jeroen

Signature

jeroen2

Martin Fishlock - 26 Jan 2006 16:32 GMT
Try:

Option Explicit

Sub Matrix()
   Dim wss As Worksheet
   Dim wsd As Worksheet
   Dim rs As Long  ' row src
   Dim cs As Long  ' col src
   Dim rd As Long  ' row dest
   
   Set wss = ActiveSheet
   Set wsd = ActiveWorkbook.Worksheets.Add ' make new sheet
   rs = 1
   cs = 1
   rd = 1
   
   'assume starts in A1
   While wss.Cells(rs, 1) <> ""
       While wss.Cells(rs, cs) <> ""
           wsd.Cells(rd, 1) = wss.Cells(rs, cs)
           rd = rd + 1
           cs = cs + 1
       Wend
       rs = rs + 1
       cs = 1
   Wend
   Set wss = Nothing
   Set wsd = Nothing
End Sub

Signature

HTHs Martin

> Hi,
>
[quoted text clipped - 21 lines]
>
> Jeroen
jeroen2 - 26 Jan 2006 17:14 GMT
Dear Martin,

Thanks very much for helping.

But I am afraid my limited programming knowledge is not enough to
understand your solution.

So I simply copied it in a macro and runed the macro but it did not
work.

Could you tell me how I should use it?

Jeroen

Signature

jeroen2

jeroen2 - 26 Jan 2006 19:57 GMT
Yes, it does work.

The mistake was in my datasheet.  I have "" in my datasheet and the
macro uses "" to detect the border of the matrix.

A big thanks

You solved a problem which kept me stuck.  Now I can analyze my data,

Jeroen

Signature

jeroen2

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.