Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Special copying of columns

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


  #2   Report Post  
Posted to microsoft.public.excel.misc
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Special copying of columns

Thank you very, very much. It works. I am very happy.

Regards
KZE


Użytkownik "Per Jessen" napisał w wiadomo¶ci ...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying across columns Gemz Excel Worksheet Functions 2 February 27th 08 03:06 PM
Transposing Rows and Columns Using Paste Special TLW Excel Discussion (Misc queries) 1 October 11th 07 04:41 PM
Excel 2003 -- Copying a formula to Paste Special into column cell FlorencePS Excel Discussion (Misc queries) 2 August 2nd 07 10:38 PM
preparing pivot fields for copying and paste special for sorting rsmith333 Excel Discussion (Misc queries) 2 June 4th 07 01:21 PM
special type of rows to columns procedure cretesupplies New Users to Excel 3 June 3rd 05 06:28 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"