Possible Duplicate:
Copy table row n times
The code below is intended to produce a table with 3 columns and 3 rows (one heading and two empty rows) but it can be seen that it doesn't work.
\documentclass{article}
\newcommand\emptytable[1]{%
\def\emptyrow{ & & \\ \hline}
\newcount\rows
\begin{tabular}{|c|c|c|}
\hline
A & B & C \\
\hline
%% the following 2 lines create 2 empty rows
%% \emptyrow
%% \emptyrow
%% the following loop doesn't work
\loop\relax\ifnum\rows<#1 \emptyrow\advance\rows by1\repeat
\end{tabular}
}
\begin{document}
\emptytable{2}
\end{document}
produces
instead of

Why does it not work?

\loopin a cell and end it in another, because table cells form groups. There are other examples in the site: 1; 2 – egreg Dec 31 '12 at 15:31