this should be a really quick question.
Is there any way to increment the value of a cell.Row?
For example, can I say something like usedCell.Row = usedCell.Row + 1?
That particular format doesn’t work, but is there another way to increase the row by 1?
The
RowandColumnproperties of a cell (i.e.Range) are read-only so you can’t increment them directly.If you want to move through the cells in column A then iDevlop’s answer works fine. An alternative method is to use the
Cellsmethod of theWorksheetobject. Example code to write the word “hello” into every cell in column A from row 1 to 100:As you can see in the example, the
Cellsmethod takes the row number as the first parameter and the column number as the second parameter.For the simple case of dealing with cells in the same column, you could also use the
Rangeproperty of theWorksheetobject and construct the actual address – e.g. A39 – each time: