Check the two different cells in the same row

T

tlee

Hi all,

Could anyone tell me how to check all cells of the same column by the
following conditions:

1) if the cell (D5) is blank and the cell (A5) is not blank, then fill data
into D5

2) if the cell (D5) is blank and the cell (A5) is blank, then no need to
fill anything


Thanks for in advance.

Tlee
 
J

Joel

It is simplier just to move a into d if a is blank or if a is not blank.

sub CheckColumns

RowCount = 1
Do while Range("A" & RowCount) <> ""
if Range("D" & RowCount) = "" then
Range("D" & RowCount) = Range("A" & RowCount)
end if

RowCount = RowCount + 1
loop

end sub
 
T

tlee

Hi Joel,

Many thanks for your help!!!

Tlee

It is simplier just to move a into d if a is blank or if a is not blank.

sub CheckColumns

RowCount = 1
Do while Range("A" & RowCount) <> ""
if Range("D" & RowCount) = "" then
Range("D" & RowCount) = Range("A" & RowCount)
end if

RowCount = RowCount + 1
loop

end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top