+ Reply to Thread
Results 1 to 9 of 9

Copy paste depending on cells property

  1. #1
    Registered User
    Join Date
    11-21-2015
    Location
    france
    MS-Off Ver
    2010
    Posts
    57

    Copy paste depending on cells property

    Hi everyone,

    I would need some help with the following macro (module 15 in file attached).

    The codes already written alows me to move from one cell to another to the right (2 cells to the right), within the chart.

    The goal would be when the selected cell comes accross a "0" (for instance on cell M28), it copies paste it on cell+2 (to the right) in AM29.
    And when it comes across a red interior cell (AK29 for instance) it copies it on cell+2 (to the right), in I26


    Thanks again for your help
    (cannot attached file for some reason, will try later on)


    Please Login or Register  to view this content.
    Last edited by ced0802; 04-09-2016 at 12:18 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Copy paste depending on cells property

    to attach file click on Reply, then GoAdvanced, then look below and click on ManageAttachments etc
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  3. #3
    Registered User
    Join Date
    11-21-2015
    Location
    france
    MS-Off Ver
    2010
    Posts
    57

    Re: Copy paste depending on cells property

    Thank you very much for your answer.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Copy paste depending on cells property

    A few questions:
    Your code is running through
    - cells in the nominated columns (E, G, I etc)
    - within range "D14:AZ76"
    - IF there is a "NUMBER" in adjacent cell to left of given cell THEN
    - SELECT given cell

    Your "RED" cell ("AK29") is not selected because there is TEXT not NUMBER in "AI29 "(text = "A83")
    Your "ZERO" value cell ("M28") is not selected because there is TEXT in "L28" (text = "A95")
    The line that causes this is:
    Please Login or Register  to view this content.
    Should this line be amended to:
    Please Login or Register  to view this content.
    so that if there is anything in column to left, then the cell is selectd?


    You say that "The goal would be when the selected cell comes across a "0" (for instance on cell M28), it copies paste it on cell+2 (to the right) in AM29. And when it comes across a red interior cell (AK29 for instance) it copies it on cell+2 (to the right), in I26"
    I really cannot see what you are wanting here
    Why does the "0" in "M28" get copied to "AM29"?
    Why does the value in "RED" cell "AK29" get copied to "I26"?

  5. #5
    Registered User
    Join Date
    11-21-2015
    Location
    france
    MS-Off Ver
    2010
    Posts
    57

    Re: Copy paste depending on cells property

    Hi Kevin,
    Thanks again for getting back to me.

    The situation is :
    When you run the macro so far (module 15), the cursor gets to the right, starting from row (today's date) (from E28, to G28, to I28 and so on). Which is what I want.

    Now what I am trying to do is :
    When the cursor meets the number "0" it copies it and pastes it to the next cell that is where the cursor will go ( so here cursor meets "0" in cell M28, and would copy and paste it in cell O28, then into cell Q28 and so on).
    The cursor at some point will meet a cell with red interior, with a number in it. ( here the first one will be in AK29). It would copy and paste it in cell AM29 then AO29).

    Thank you so much for wanting to help!

  6. #6
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Copy paste depending on cells property

    So we paste a zero until we hit a "RED" cell, and then we paste value of "RED" Cell, until we hit a zero, and then we paste a zero until we hit a "RED" cell etc?

  7. #7
    Registered User
    Join Date
    11-21-2015
    Location
    france
    MS-Off Ver
    2010
    Posts
    57

    Re: Copy paste depending on cells property

    Yes you summed up my 10 sentences of explanation into 1

  8. #8
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Copy paste depending on cells property

    Try this.
    I was not sure what you wanted to use as the stock value at the beginning of first row matching the date test.
    Amend this line to make that value correct.
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Question
    This assumes that cells are either blank, zero or RED with value. Could they hold a value >0 and not be RED?
    Last edited by Kevin#; 04-13-2016 at 04:39 AM. Reason: Question

  9. #9
    Registered User
    Join Date
    11-21-2015
    Location
    france
    MS-Off Ver
    2010
    Posts
    57

    Re: Copy paste depending on cells property

    Hi Kevin,

    Sorry for late answer.
    It is working, thank you so much for that !
    Much appreciated.

+ 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] Copy and Paste in different locations depending on adjacent cell value
    By ScabbyDog in forum Excel General
    Replies: 19
    Last Post: 01-23-2016, 02:17 PM
  2. copy & paste to other sheets depending on dates specified in cells
    By ufopilot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2015, 05:43 AM
  3. Copy range and paste depending on the selected checkbox
    By mackypogi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2014, 10:38 PM
  4. Copy and paste from one worksheet to another depending on date
    By darrenb78 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-04-2013, 01:31 PM
  5. [SOLVED] Copy paste depending on certain criteria (VBA)
    By bonny24tycoon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 07:59 AM
  6. Copy and Paste macro depending on a cell
    By john_london in forum Excel General
    Replies: 4
    Last Post: 11-08-2010, 11:05 AM
  7. Copy and Paste Depending on Cell
    By Craig2097 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2010, 11:29 AM

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