The following macro should activate worksheet Matrix Table then print
out some text and then print out the values in the Nstep_tran array.
Since I don't have a row counter, I am in the process of working out
the formula for the Else case. What follows Else is a place holder.

 I cannot get the initial Cnt=1  case to work without hitting a run
time error. I don't see any obvious typos. Do you?

Call Mat_table(Cnt, Nstep_Trans)

Sub Mat_table(Cnt, Nstep_Trans)
Worksheets("Matrix Table").Activate
If Cnt = 1 Then
    Cells(Cnt, 1).Text = "Matrix Raised to a Power"
    Cells(Cnt, 2).Value = 1
Else
    Cells(Cnt, 1).Text = "Matrix Raised to a Power"
    Cells(Cnt, 2).Value = Cnt
End If
For I = 1 To No_States
    For J = 1 To No_States
   Cells(Cnt + I, J).Value = Nstep_Trans(I, J)
   Next J
Next I
End Sub

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to