Enter same value in multiple cells

Topics: User Forum
Jun 26, 2010 at 10:28 AM
I need to sometimes enter the same value in like 10 cells from the same row. Is there a way to enter a value in a range of cells, in order to avoid writing the following code:? $objWorksheet->getCell('A1')->setValue($x) $objWorksheet->getCell('A2')->setValue($x) .................................................................................... $objWorksheet->getCell('A10')->setValue($x) Thanks in advance
Coordinator
Jun 29, 2010 at 9:16 AM

There is currently no method other than setting each cell explicitly, or looping through the cells:

for($row=1;$row<=10;$row++) {
   $objWorksheet->getCell('A'.$row)->setValue($x)
}