View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Special copying of columns

Hi

This macro should do it:

Sub FillIn()
Dim cell As Range
For Each cell In Range("A1", Range("A1").End(xlDown))
If cell.Offset(0, 1).Value = "" Then
cell.Offset(0, 1) = cell.Value
End If
Next
End Sub

To open the VBA editor hit Alt+F11, goto Insert Module. Paste the above
code into the the code sheet.

Regards,
Per

"KaZetE" skrev i meddelelsen
...
Hi,

I need your help again :-(

I have two columns A and B.
In column A there are values of general type,
in fact there are strings of characters.
In column B there are values of general type
or fields are empty.
The values in columnB can be equal to those
in columnA or can be different.
What I need is to copy values from columnA
to columnB but only if the field in columnB
was empty.

For example:
ColumnA ColumnB
qwe tyf
fgyed
jdge jdge
ifresg plk
sgdhey
utshr utshr
etc.

The result should be:
ColumnA ColumnB
qwe tyf
fgyed fgyed
jdge jdge
ifresg plk
sgd sgd
utshr utshr
etc.

Of course the sheet contains hundreds of records
so it would be terrible to do it handy.

If anyone knows how to do it, please tell me.
I"ll be very grateful :-)

Regards
KZE