Jimekus
1/9/2012 11:12:00 AM
On Jan 9, 11:03 pm, avi <avi...@bezeqint.net.il> wrote:
> Hello,
>
> I'm looking for some code that transposes the grid table (Row become
> columns and columns become rows)
>
> Thanks
> Avi
Presumably you are normally saving your table to a text file by rows
and columns. So, just write the table to a transposed text file by
columns and rows and then reload that text file with your normal input
routine. The following is a snippet of code minus the normal headers
and footers that normally accompany my saved tables.
NB: because I have some cells that contain carriage returns and line
feeds, these are spaced out first before printing so as to not upset
the normal delimiters you need when rereading the transposed table.
Open FullGridName For Output As #One
.... header... goes here.
For ColItem = One To LastDataCol + Three
workz6 = GridIn.Table.TextMatrix(One, ColItem)
While InStr(workz6, vbLf)
Mid$(workz6, InStr(workz6, vbLf), One) = ASpace
Wend
Print #One, workz6;
For RowItem = Two To NmC + Three
workz6 = GridIn.Table.TextMatrix(RowItem, ColItem)
While InStr(workz6, vbCr)
Mid$(workz6, InStr(workz6, vbCr), One) = ASpace
Wend
While InStr(workz6, vbLf)
Mid$(workz6, InStr(workz6, vbLf), One) = ASpace
Wend
Print #One, vbTab; workz6;
Next
Print #One,
Next
Print #One, Zero ' zero signifies that there is no footer.
Close #One
..... this is where you would reload the file using your normal load
routine.