1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel - Conditional Copy / Paste (Same Worksheet) based on cell values

Discussion in 'Business Applications' started by Muckem333, Feb 2, 2011.

Thread Status:
Not open for further replies.
  1. Muckem333

    Muckem333 Thread Starter

    Joined:
    Dec 18, 2009
    Messages:
    8
    Hello,

    A pretty inexperienced VBA'er here.

    I have 2 named ranges:

    - LastStatus = "J8:J500"
    - CurrentStatus = "K8:K500"

    What I would like to do is create a loop to copy the cells in CurrentStatus over to the LastStatus column if and only if there is a value in CurrentStatus (column K). If there is no value in column K and there is a value in column J, I do not want change the value in column J.

    Any help would be greatly appreciated.

    Brian
    [​IMG]
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,546
    You don't need a loop.

    Sub test()
    Range("LastStatus").SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=IF(RC[1]<>"""",RC[1],"""")"
    Range("LastStatus").Value = Range("LastStatus").Value
    End Sub
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/978394

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice