--- loncom/interface/Attic/lonspreadsheet.pm	2002/11/21 18:56:36	1.145
+++ loncom/interface/Attic/lonspreadsheet.pm	2002/11/21 19:50:49	1.148
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.145 2002/11/21 18:56:36 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.148 2002/11/21 19:50:49 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1530,10 +1530,9 @@ A link to the spreadsheet will be availa
 END
     $r->rflush();
     my $starttime = time;
-    foreach (keys(%f)) {
-	next if ($_!~/^A(\d+)/ || $1 == 0 || ($f{$_}=~/^[!~-]/));
+    foreach my $rownum (&sort_indicies($sheet)) {
         $count++;
-        my ($sname,$sdom) = split(':',$f{$_});
+        my ($sname,$sdom) = split(':',$f{'A'.$rownum});
         my $student_excel_worksheet=$workbook->addworksheet($sname.'@'.$sdom);
         # Create a new spreadsheet
         my $studentsheet = &makenewsheet($sname,$sdom,'studentcalc',undef);
@@ -2065,6 +2064,9 @@ sub format_html_rowlabel {
                 '&mapid='.$mapid.'&resid='.$resid.'">'.$title.'</a>';
     } elsif ($type eq 'student') {
         my ($sname,$sdom,$fullname,$section,$id) = split(':',$labeldata);
+        if ($fullname =~ /^\s*$/) {
+            $fullname = $sname.'@'.$sdom;
+        }
         $result ='<a href="/adm/studentcalc?uname='.$sname.
             '&udom='.$sdom.'">';
         $result.=$section.'&nbsp;'.$id."&nbsp;".$fullname.'</a>';
@@ -2317,7 +2319,8 @@ sub updatestudentassesssheet {
     $sheet->{'maxrow'} = 0;
     my %existing=();
     # Now obsolete rows
-    while (my ($cell, $formula) = each (%f)) {
+    foreach my $cell (keys(%f)) {
+        my $formula = $f{$cell};
         next if ($cell !~ /^A(\d+)/);
         $sheet->{'maxrow'} = $1 if ($1 > $sheet->{'maxrow'});
         my ($usy,$ufn)=split(/__&&&\__/,$formula);