+ Reply to Thread
Results 1 to 7 of 7

Event change copy paste

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Event change copy paste

    I have two worksheets, and when the value in one changes I'd like the value in the other to change as well. Pasting a link doesn't work, because on the "Paste to" sheet I've applied conditional formatting, and it doesn't register a change event when it's a pasted link. I tried running a macro to copy the whole column and paste it on a change event, but that didn't alert the conditional formatting to kick in.

    The "Paste From" sheet has dropdowns in column C. The "Paste to" sheet has corresponding dropdowns in column F. So, if someone changes the selection in C3 on "Paste From", I'd like F3 on "Paste to" to change. Is there a way?
    Last edited by jomili; 02-02-2010 at 01:43 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Event change copy paste

    Quote Originally Posted by jomili View Post
    ... and it doesn't register a change event when it's a pasted link.

    What does this mean? Does Conditional Formatting work on an event? I set up two workbooks with a link and conditional formatting that said if cell > 10, background color = red. When I changed the value in the book to 11, the linked cell turned red.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Event change copy paste

    Let me see if I can phrase it better:

    When I make a change in Cell C1 in "Paste From" I want F1 in "Paste To" to change it's value and apply the conditional formatting associated with that value. However, my cells in "Paste To" are kind of funky, in that each cell in column D has multiple paragraphs, and the first line is in italics. There WAS (past tense) a problem with the conditional formatting not formatting all of the text, so I have a macro to help with that. However, now that I'm pasting the link, it's messing with the font formatting again. A "Yes" in Column C/F should strike out all text. However, if changing a "Yes" to a "No" or "Unknown" in Paste From, the link changes to a "No" or "Unknown", but the strikethrough is not removed.

    I've attached a sample spreadsheet with the macro in place. Please let me know if you can see any solution.
    Attached Files Attached Files

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Event change copy paste

    I see, so the real issue here is that you have a macro to change the strikethrough on your font, but it only runs on a worksheet change event. If the change isn't made to that worksheet, i.e. to the linked worksheet instead, the strikethrough doesn't change.

    Can you switch the code on the "Paste From" sheet to something like this?:

    Please Login or Register  to view this content.
    It is more efficient than copying and pasteing, and will trigger the event on the "Paste to" sheet.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Event change copy paste

    Wow! Dave, you rock my world!

    Your addition worked wonderfully, exactly the way I wanted it to. I'm still a newbie at VBA, so I love to see a master at work. If you don't mind, I'd like to ask a few questions:
    Please Login or Register  to view this content.
    I'm not familiar with Target.Row. Is this remembering the row the cell is in? And then in
    Please Login or Register  to view this content.
    is this saying "okay, in Row i, grab the value of column F"?

    I know
    Please Login or Register  to view this content.
    takes the value of strValue and puts it in the corresponding cell on "Paste to". What would you do if it wasn't the same line, for instance 2 lines down?

    I'll go ahead and mark this one solved, but I'd appreciate a last reply to my questions.

    Thanks Big Time!

  6. #6
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Event change copy paste

    You're most welcome, glad I could help.

    Please Login or Register  to view this content.
    Takes the Target, which is the cell clicked, and makes the variable i = the row.

    Please Login or Register  to view this content.
    You're right on for this one.

    Please Login or Register  to view this content.
    To make this two lines lower, add two to the row like so:

    Please Login or Register  to view this content.
    By the way, I'm far from a master. But most of what I know I learned at this forum. Thus, I pass on your praise to all here.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Event change copy paste

    Dave,

    Thanks for the explanation, and kudos to all those here who taught you. You've learned well.

+ 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