Edit: Split from Paste cell to more than one non-contiguous cell since this is a new subject that the OP did not ask about |
And sometimes data is stored with "non-repeating" row labels. And you need to fill in the blanks to process the data in the pivot table.
And keeping them "correct" means storing redundant data.
I have two macros for this case: SelectEmptyCells() and FillEmptyCells(). Exclusively for filling with values in the rows above.
And here is how the value assignment works
Code: Select all
' Assigns a value (formula, number, or text) to cells in a rectangular range.
Sub AssignValueToRange(oRange As Object, value)
' The .Formula property should cover all input needs, even numbers.
oRange.getCellByPosition(0, 0).Formula = value 'the lead cell
With com.sun.star.sheet.FillDirection
oRange.fillAuto(.TO_BOTTOM, 1) '0
oRange.fillAuto(.TO_RIGHT, 1) '1
End With
End Sub
UPD:
And if you need to enter a different formula?
Question: How do I get the value in cell A3 programmatically so that I can enter it into the rest of the blank cells?
In Excel, this task is solved simply, as requested by the author of the topic (with multiple insert).