J'ai juste changé un poil,
if ((r.offset(0 , 0).getValue() != '') && (r.offset(0 , -1).getValue() != '') && (r.offset(-1, 0).getValue() == r.offset(0, 0).getValue()) && (r.offset(-1, 0).getValue() == r.offset(0, 0).getValue()))
en
if ((r.offset(0 , 0).getValue() != '') && (r.offset(0 , -1).getValue() != '') && (r.offset(-1, 0).getValue() == r.offset(0, 0).getValue()) && (r.offset(-1, -1).getValue() == r.offset(0, -1).getValue()))
j'ai fait un essai et c'est bon