+ Reply to Thread
Results 1 to 6 of 6

Paste to a cell A1 without breaking formula? (Urgent!!!)

  1. #1
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    208

    Paste to a cell A1 without breaking formula? (Urgent!!!)

    Hi guys,

    I have a formula on a cell A1 and have a VBA code running on the same worksheet which copy and paste another cell from different worksheet to the cell A1. (See the code below)

    Please Login or Register  to view this content.
    But when the value from a cell in another worksheet is paseted on the the cell A1, it also breaks the formula in cell A1.

    Anyone any idea????

    Cheers,

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste to a cell A1 without breaking formula? (Urgent!!!)

    Don't paste it in A1??
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Paste to a cell A1 without breaking formula? (Urgent!!!)

    xladept, I am usnig the worksheet as a data entry form and occasionally I need to bring up some of the data I have previously saved in another worksheet on the data entry form. And when I bring up the data back to the entry form, it breaks the formula used in A1. Any other suggestion? Thanks

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Paste to a cell A1 without breaking formula? (Urgent!!!)

    I personally have never been fond of this kind of "have one cell that contains two possible things" approach. Exactly as you describe it, you will never be able to "paste values" and still retain the the formula that normally resides in A1.

    If everything has to occur in A1, then you will need a second procedure that can paste the desired formula back into A1 when you are done with the value that this procedure pastes in.

    My personal preference for this sort of thing is more like xladept suggests. Instead of pasting the value into A1 and breaking the formula, paste the value into another cell. Then wrap the formula in A1 inside of an =IF() function. Maybe something like =IF(isempty(B1),current formula in A1,B1) http://office.microsoft.com/en-us/ex...in=HA010277524 With this solution, whenever you or your macro puts something into B1, then A1 will use that value to "override" the current formula. When you want to revert back to the formula, clear B1.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Paste to a cell A1 without breaking formula? (Urgent!!!)

    Hi MrShorty and xladept, I knew how to use IF () function but didn't realise until you brought that to my attention that I can get the result I want by simply using the IF () function as you explained above. Thanks for educating me on this. Ta

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Paste to a cell A1 without breaking formula? (Urgent!!!)

    Yes - I also thank you Mr. Shorty!

+ 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