Does something
// Write values
forvalues i = 2/`nRows' {
forvalues j = 2/`nCols' {
// Get the placement
local theCol : word `j' of `c(ALPHA)'
local theRow = `i'
// Get the values
local nStars = `anything'_STARS[`=`i'-1',`=`j'-1']
local nStars = min(3,`nStars')
local theValue = `anything'[`=`i'-1',`=`j'-1']
// Set the formatting
local theFormat = `format'*"0" + `nStars'*"\*" + `=3-`nStars''*"_*"
qui cap putexcel `theCol'`theRow' = `theValue' , nformat(#.`theFormat')
putexcel close
}
}