ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adding a value to blank cells (https://www.excelbanter.com/excel-discussion-misc-queries/57940-adding-value-blank-cells.html)

Rugby Al

Adding a value to blank cells
 
I have a spreadsheet with a number of blank cells in a column, I want to fill
these cells with a another cell value from a different column, the value
will need to change every time a non blank cell is reached, as will the data
to be put in to the next section of blank cells. I can send a small sample of
data if required.

Regards

exceluserforeman

Adding a value to blank cells
 
sub Blank_Cells_with_Values()
dim CELL

range("A1").select
set a=selection
range(a,a.specialcells(xllastcell)).select
for each CELL in selection

if CELL.Text="" then
CELL.value=cell.offset(0,3).value
end if
next
end sub

cell.offset(0,3).value is the third colmn (on the same row) from the cell
being evaluated. So the blank CELL will have that value.

http://www.geocities.com/excelmarksway

- -Mark








"Rugby Al" wrote:

I have a spreadsheet with a number of blank cells in a column, I want to fill
these cells with a another cell value from a different column, the value
will need to change every time a non blank cell is reached, as will the data
to be put in to the next section of blank cells. I can send a small sample of
data if required.

Regards


Rugby Al

Adding a value to blank cells
 
Thanks for the info Mark, but still very confused, I could send a sample of
the data if it would help

Regards

"exceluserforeman" wrote:

sub Blank_Cells_with_Values()
dim CELL

range("A1").select
set a=selection
range(a,a.specialcells(xllastcell)).select
for each CELL in selection

if CELL.Text="" then
CELL.value=cell.offset(0,3).value
end if
next
end sub

cell.offset(0,3).value is the third colmn (on the same row) from the cell
being evaluated. So the blank CELL will have that value.

http://www.geocities.com/excelmarksway

- -Mark








"Rugby Al" wrote:

I have a spreadsheet with a number of blank cells in a column, I want to fill
these cells with a another cell value from a different column, the value
will need to change every time a non blank cell is reached, as will the data
to be put in to the next section of blank cells. I can send a small sample of
data if required.

Regards



All times are GMT +1. The time now is 07:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com