Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying across columns | Excel Worksheet Functions | |||
Transposing Rows and Columns Using Paste Special | Excel Discussion (Misc queries) | |||
Excel 2003 -- Copying a formula to Paste Special into column cell | Excel Discussion (Misc queries) | |||
preparing pivot fields for copying and paste special for sorting | Excel Discussion (Misc queries) | |||
special type of rows to columns procedure | New Users to Excel |