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: 244
Default Destination:=matrix

I have a macro in which I am trying to sort data. The data is stored in a
table and every column has a unique header. One of the columns have a header
called €śSec type€ť. If the vale in that column is €śGOV BOND€ť then I want to
look at the column marked by the header €śSec ID€ť. The data in that column is
stored like this: NAME YIELD MATURITY. For example: ACGB 4.75 0311, T 5.10
0420, FROG 3.11 1020X. Now as you can see the €śSec ID€ť has the same form but
it differs in terms of characters etc. I want to sort the entire table based
on maturity. Thus, I want to single out the maturity and then sort the list.
For certain reasons I do not want 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 and tries to
store the new columns in the matrix. I have spare room for the new data so
that is not a problem. My problem is that I do not know how 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 every row I
look to see if the text in €śSec type€ť is €śGOV BOND€ť. If so I increase the
matrix and then I use text-to-columns (from a recorded 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(tableLength - 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 proper destination. Now
I have: Destination:=varDataMatris(tableLength - 2, tableLength - 1,
tableLength) which is completely wrong. I want to place the data retrieved
from the text-to-columns in the rightmost 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 is very much appreciated but I cannot
change the setup very much but I need to find the code for how to specify the
right address in matrix! Many thanks in advance!

 
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
How can I transpose nXm matrix to mXn Matrix MIHir Excel Worksheet Functions 2 August 9th 08 11:44 AM
Keep Destination Format SteveT Excel Discussion (Misc queries) 2 October 24th 07 03:42 PM
Destination Cell Steak77 Excel Discussion (Misc queries) 0 July 28th 06 06:24 PM
Destination range marpetban Excel Discussion (Misc queries) 0 July 5th 06 02:51 PM
destination formating Ruben Mikkelsen Excel Programming 1 February 25th 05 11:24 PM


All times are GMT +1. The time now is 07:08 PM.

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"