Consulting

Results 1 to 4 of 4

Thread: Code that detects data in cells and pastes data into the next cells

  1. #1
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    2
    Location

    Code that detects data in cells and pastes data into the next cells

    Does anyone have any advice on how I can have some code that will copy certain cells for example A3 D3 and E3 and paste them into for example J3, K3 and L3. But as it would be pasted into a table that is have the dates running down the I column. The code would have to detect that there is already data in J3, K3 and L3 and paste it into J4, K4 and L4 and then the next day the code would need to detect there is data in J3-4, K3-4 and L3-4 and would need to paste it into J5 etc and so on. Been trying to figure this out for ages now so any help would be greatly appriciated.

    Thank you.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    try
    Set Destn = Cells(Rows.Count, "J").End(xlUp).Offset(1)
    Range("A3,D3:E3").Copy Destn
    Be aware that if ever A3 is blank when it's copied, the next time the destination cell will be the same cell.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    2
    Location

    When I run it I get a compile error wrong num of arguments or property assignments

    Quote Originally Posted by p45cal View Post
    try
    Set Destn = Cells(Rows.Count, "J").End(xlUp).Offset(1)
    Range("A3,D3:E3").Copy Destn
    Be aware that if ever A3 is blank when it's copied, the next time the destination cell will be the same cell.

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    I get no error here. Where are you placing the code?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •