+ Reply to Thread
Results 1 to 3 of 3

copying a cell

Hybrid View

  1. #1
    Nestor
    Guest

    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. #2
    Tom Ogilvy
    Guest

    RE: 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(xlup))
    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. #3
    Nestor
    Guest

    Re: copying a cell

    Thank you - this also worked:

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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1