You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openoffice.apache.org by Brian Barker <b....@btinternet.com> on 2013/02/11 07:55:29 UTC
Re: Macro for filling in blank cells
At 20:26 10/02/2013 -0500, Jason Cipriani wrote:
>I'd like to be able to go down a column, and fill every blank cell
>with the same content as the first non-blank cell above it. So if I have:
>
>5
>*blank*
>*blank*
>*blank*
>6
>7
>8
>*blank*
>9
>*blank*
>10
>*blank*
>
>I want to be able to select those cells in that column and have it changed to:
>
>5
>5
>5
>5
>6
>7
>8
>8
>9
>9
>10
>10
>
>Is it possible to write a macro to do this (or is there maybe
>something already built in)?
You realise that you can do this manually very easily?
We'll have to assume that your top cell is always occupied; I'll also
assume that "*blank*" means empty. Suppose that your values are in
column A. In B1, enter =A1. In B2, enter =IF(A2="";B1;A2) . Fill
just B2 down the column. Now you have a few choices: you can use
column B for further calculation in place of column A, possibly
hiding either column A or column B, or you can copy the values in B
back over A (using Paste Special... to freeze the values), possibly
then deleting either column B or its contents.
I trust this helps.
Brian Barker
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-help@openoffice.apache.org
Re: Macro for filling in blank cells
Posted by Jason Cipriani <ja...@gmail.com>.
On Mon, Feb 11, 2013 at 1:55 AM, Brian Barker <b....@btinternet.com>wrote:
> At 20:26 10/02/2013 -0500, Jason Cipriani wrote:
>
>> I'd like to be able to go down a column, and fill every blank cell with
>> the same content as the first non-blank cell above it. So if I have:
>>
>> 5
>> *blank*
>> *blank*
>> *blank*
>> 6
>> 7
>> 8
>> *blank*
>> 9
>> *blank*
>> 10
>> *blank*
>>
>> I want to be able to select those cells in that column and have it
>> changed to:
>>
>> 5
>> 5
>> 5
>> 5
>> 6
>> 7
>> 8
>> 8
>> 9
>> 9
>> 10
>> 10
>>
>> Is it possible to write a macro to do this (or is there maybe something
>> already built in)?
>>
>
> You realise that you can do this manually very easily?
>
> We'll have to assume that your top cell is always occupied; I'll also
> assume that "*blank*" means empty. Suppose that your values are in column
> A. In B1, enter =A1. In B2, enter =IF(A2="";B1;A2) . Fill just B2 down
> the column. Now you have a few choices: you can use column B for further
> calculation in place of column A, possibly hiding either column A or column
> B, or you can copy the values in B back over A (using Paste Special... to
> freeze the values), possibly then deleting either column B or its contents.
>
>
Thanks!! That works great. I gave up with the macro after a good 30 minutes
of cross-referencing documentation to write 3 lines of code. :-S
But this is perfect.
Thanks again,
Jason