Thanks for the code. It is well written and very well documented. In particular, I have a question regarding the code in Credit_VaR.m. In step 2 (initial portfolio valuation) and in step 6 (valuation based on the simulated ratings) you use the same dates for pricing. I think one should use dates one year ahead (or at the end of the VaR estimation horizon) in step 6 (using the prbyzero function). Furthermore, could you be more specific on what you mean by interest rates in the file Credit Portfolio.xlsx (sheet Transitions and Rates). Are these one year forward rates?
@JH: As I said many times before, please have a look at the listings documentation (type "texdoc listings" in a command prompt, or find it here: http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf), Section 4.8 in particular.