LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text-to-columns. Destination:=matrix


I have a macro in which I am trying to sort data. The data is stored i
a table and every column has a unique header. One of the columns have
header called “Sec type”. If the vale in that column is “GOV BOND” the
I want to look at the column marked by the header “Sec ID”. The data i
that column is stored like this: NAME YIELD MATURITY. For example: ACG
4.75 0311, T 5.10 0420, FROG 3.11 1020X. Now as you can see the “Se
ID” has the same form but it differs in terms of characters etc. I wan
to sort the entire table based on maturity. Thus, I want to single ou
the maturity and then sort the list. For certain reasons I do not wan
to add new columns etc. but handle this “inside” the program.

The way I attack the problem now is that I use text-to-columns an
tries to store the new columns in the matrix. I have spare room for th
new data so that is not a problem. My problem is that I do not know ho
to refer to the places in the matrix where I want to store the data
Let me show you some code:

I loop through the table by looking in the “Sec ID”-column. For ever
row I look to see if the text in “Sec type” is “GOV BOND”. If so
increase the matrix and then I use text-to-columns (from a recorde
macro).

Do Until IsEmpty(rngSecID.Offset(r, lngTypeColumn))
r = r + 1
If rngSecID.Offset(r, lngTypeColumn).Text = strGovBond Then
ReDim varDataMatris(1 To tableLength, 1 To r)
rngSecID.Offset(r, 0).Select
Selection.TextToColumns Destination:=varDataMatris(tableLengt
- 2, tableLength - 1, tableLength), DataType:=xlDelimited
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False
Semicolon:=False, Comma:=False, Space:=True, Other:=False
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
TrailingMinusNumbers:=True
End If
Loop

My problem is that I do not know how to refer to the prope
destination. Now I have: Destination:=varDataMatris(tableLength - 2
tableLength - 1, tableLength) which is completely wrong. I want t
place the data retrieved from the text-to-columns in the rightmos
columns in the matrix. The row is to be the same as in the list i.e. r
I really have no idea how to write that. Please help me out! Any help i
very much appreciated but I cannot change the setup very much but I nee
to find the code for how to specify the right address in matrix! Man
thanks in advance

--
freddie ma
-----------------------------------------------------------------------
freddie mac's Profile: http://www.excelforum.com/member.php...fo&userid=3610
View this thread: http://www.excelforum.com/showthread.php?threadid=57408

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding columns to an Excel matrix and listing them in the PT Jellis65 Excel Worksheet Functions 1 October 16th 07 11:44 PM
Destination:=matrix Arne Hegefors Excel Programming 0 August 22nd 06 09:35 AM
matrix columns to rows J_J[_2_] Excel Programming 4 June 3rd 05 06:37 AM
Creating a matrix from columns Ernie Sersen Excel Discussion (Misc queries) 2 February 17th 05 04:31 PM
Create matrix data from two columns? Dav Bran Excel Programming 0 October 23rd 03 07:37 PM


All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"