The borders of this table do not close completely when I use the \multicolumn command. Also in the last row between columns C & D, I have the same problem. I am sure there is a easy fix to this, but struggling to find how.
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\renewcommand{\arraystretch}{1.2}
\usepackage{tabularx}
\newcolumntype{P}[1]{>{\centering\arraybackslash}m{#1}}
\begin{table}[htbp!]
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|P{1.5cm}|P{3cm}|P{2.65cm}|P{1cm}|P{1cm}|P{1cm}|P{1cm}|}
\hline
\multicolumn{3}{l}{} & \multicolumn{4}{c}{Total count} \\
\hline
CLC & CLC Description & Ecological Impact Rating & S1 & S2 & S3 & S4\\
\hline
222, 223 & Fruit plantations and groves & 0.6 & 11 & 9 & 7 & 5 \\
211, 213, 221, 241, 243 & Agricultural land & 0.8 & 3178 & 2726 & 1446 & 2238 \\
311, 312, 313 & Forests & 1.0 & 3953 & 3804 & 2082 & 674 \\
\hline
\multicolumn{3}{l}{Calculated aggregate} & 6502 & 5990 & 3243 & 2467\\
\hline
\end{tabularx}
\end{table}
\multicolumn{4}{c}
should be\multicolumn{4}{c|}
to put the line back, and similarly the other cases