+ Reply to Thread
Results 1 to 4 of 4

copy paste problem if target cell contains formula

  1. #1
    Registered User
    Join Date
    11-22-2010
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    2

    copy paste problem if target cell contains formula

    Hi,

    I have a big dataset in a particular sheet. Each month the outcome of the figures in the cells CJ87:CV1000 needs to be copied and pasted as hard values in cells L87:w1000. (This in order to start with updated data for the new month). Columnheader January is represents by column L (old figures) and CJ (new figures to be copied into L) and February is M and CK and so on.

    All the values in range CJ87:cv1000 are calculated by formulas, but multiple rows in range L87:w1000 are subtotals(calculated) and other cells hard values. The formulas in this range needs to be kept untouched.

    I have 2 ways in mind to let this work.

    1-

    each cell with a value in range CJ87:CV1000 needs to be copied, then offset (0, -77) and pasted as value. But if the target cell contains a formula than the paste needs to be aborted and the macro must find the next cell in the range.

    or 2-

    The dataset is completely protected, but not the range CJ87:CV1000.
    The macro search for not protected cells. Finds the first unprotected cell, then unprotects the sheet and offsets -77 and pastes the value. Than it protects the sheet again and searches for the next unprotected cell and repeats the whole process as above.

    Thankx for the advise.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: copy paste problem if target cell contains formula

    You mention a macro, yet you posted the question in the Worksheet Functions forum. I've moved the question to the Programming forum. Please take care to post in the appropriate forum.

    cheers,

  3. #3
    Registered User
    Join Date
    11-22-2010
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: copy paste problem if target cell contains formula

    This code is in a way working, but it doesn't copy cells wich contains formulas to the target cells as values. It must copy all the cells as hard values to target, but must abort the action if the target cell contains a formula. Help wanted.

    Please Login or Register  to view this content.
    Last edited by teylyn; 11-23-2010 at 06:19 AM. Reason: added code tags

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: copy paste problem if target cell contains formula

    Masterx,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    I added the code tags for you, but this time only. Please read the forum rules and use code tags when posting code.

+ 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