#1   Report Post  
Posted to microsoft.public.excel.misc
Nestor
 
Posts: n/a
Default copying a cell

does anyone know an easy way to copy a cell in column 1 to column 2
only when the cell in column 2 is blank orempty?

Thank you
Nestor

  #2   Report Post  
Posted to microsoft.public.excel.misc
Tom Ogilvy
 
Posts: n/a
Default copying a cell

Do alt+F11 and then Insert=Module
in that module place code like:

sub copytoBlanks()
Dim icol as LOng, cell as Range, rng as Range
icol = 1
set rng = Range(cells(1,icol),cells(rows.count,icol).End(xlu p))
for each cell in rng
if isempty(cell.offset(0,1)) then
cell.offset(0,1).Value = cell.value
end if
Next
end sub

Change icol to the column you want to process. As written it processes A
(source column) and B (copy to column) (icol = 1, column to right is B).

go back to Excel, then do Tools=Macro=Macros, select CopyToBlanks and
click run



--
Regards,
Tom Ogilvy


"Nestor" wrote:

does anyone know an easy way to copy a cell in column 1 to column 2
only when the cell in column 2 is blank orempty?

Thank you
Nestor


  #3   Report Post  
Posted to microsoft.public.excel.misc
Nestor
 
Posts: n/a
Default copying a cell

Thank you - this also worked:

=IF(ISBLANK(B3),A3,B3)

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
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
copying the function contained within a cell to anouther cell. DMB Excel Worksheet Functions 2 September 1st 05 05:49 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Problems copying street addresses and dates C. Dales Excel Discussion (Misc queries) 4 February 11th 05 01:43 PM


All times are GMT +1. The time now is 07:15 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"