+ Reply to Thread
Results 1 to 6 of 6

Intersect, Target, Range - referencing from another cell, a problem....

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Intersect, Target, Range - referencing from another cell, a problem....

    Hi,

    I have this private sub on a worksheet.


    Please Login or Register  to view this content.
    This works fine, copying the value of the cell selected in column C, and pasting it to the range U2 on 'Sheet1'.

    However, I've now referenced the value of C5:C1000 from cells D5:D1000. So C5=D5, C6=D6 etc... This is causing the above code to not quite work. When i then click on a cell it copies the value of "V2" on Sheet1 into cell "U2" on Sheet1. I realize this is something to do with the fact that Im now referencing another cell (one across from the original), but i cant quite work out how to fix it.

    Any ideas?


    ps: I have to reference the cells, as another macro on another sheet copies and pastes information into the sheet with the code (ie into C5:C1000) As a result this automatically triggers the private sub - which i don't want it to do. So referencing it means the private sub doesn't get triggered when the other macro runs.
    Last edited by Barking_Mad; 02-17-2014 at 09:19 AM. Reason: corrected code.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Intersect, Target, Range - referencing from another cell, a problem....

    There is no code here that will copy column V. However you may keep your original code and simply add@
    Please Login or Register  to view this content.
    to the beginning of the other copy macro and add:
    Please Login or Register  to view this content.
    to the end. This will stop this SelectionChange event from running. (also, it is probably that your other code does not need to select anything which would also remove this problem )
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Intersect, Target, Range - referencing from another cell, a problem....

    Edit - typing a new explanation, please hold
    Last edited by Barking_Mad; 02-17-2014 at 09:21 AM.

  4. #4
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Intersect, Target, Range - referencing from another cell, a problem....

    Thanks, i tried your instructions and it worked just fine. Plus i learnt something nice

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Intersect, Target, Range - referencing from another cell, a problem....

    I see - you have formulas in column C now? So you must use:
    Please Login or Register  to view this content.
    instead of this:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Intersect, Target, Range - referencing from another cell, a problem....

    Quote Originally Posted by Izandol View Post
    I see - you have formulas in column C now? So you must use:
    Please Login or Register  to view this content.
    instead of this:
    Please Login or Register  to view this content.
    Hi,

    Thanks - that also solves the problem! Although ill go with the first one as Im guessing its better coding.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Multiple Target Intersect Ranges on Same Worksheet
    By Mistweaver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2013, 04:35 PM
  2. Replies: 2
    Last Post: 01-29-2013, 09:38 AM
  3. Problem with Intersect(Target)
    By fcarboni in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2012, 09:02 AM
  4. Worksheet_CHange (ByVal Target as Range) when target is formula cell
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 07:00 PM
  5. referencing rows using variable and Intersect range
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2009, 02:19 PM

Tags for this Thread

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