+ Reply to Thread
Results 1 to 12 of 12

Copy to next row (not working)

  1. #1
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Copy to next row (not working)

    But I can't run this simple piece of code.

    ////////////////////////

    Sub Selectnxtempty()

    Dim A1_store As Range

    Dim Anext_store As Range

    Set Anext_store = Range("A1").End(x1Up).Offset(1).Value.Select

    Anext_store.Value = A1_store

    End Sub


    //////////////////////////////////

    "1004 Run time error"


    Can anyone help.
    I want to try to store data from (a set of cells) one Worksheet into a table on another Worksheet,
    Then change those cell values (on initial sheet) and store the new data on the next row down of the table on worksheet with the table.

    I should mention the about code doesn't transfer data between Worksheets. I'm just trying to get a feel for the code.

    I hope that makes sense.
    Last edited by psyclone101; 09-03-2021 at 03:46 PM.

  2. #2
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    can't post link to where I saw this code.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy to next row (not working)

    For a real first beginning change
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    What is the contains for A1_store, where to pick up value ?

    BTW
    Use code tags
    Last edited by PCI; 09-03-2021 at 05:19 PM.
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    Cell A1, I can see now I have not linked the value in Cell A1 to A1_store,
    But
    the following line is causing an error

    HTML Code: 
    Last edited by psyclone101; 09-04-2021 at 02:59 AM. Reason: incorrect code

  5. #5
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    ///.////////

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy to next row (not working)

    You try to go up before cell "A1"
    Use (NOT tested)
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    Thanks for your help.
    I'm still getting an error

    When I hover over x1Up --> it says it's empty. could this be the problem?
    Is there a setting I need to adjust to run this code?

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy to next row (not working)

    If you want to use the cell just after the last cell in column "A", Use
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    Thanks for that. That works,
    I've tried running the following code and I've seen someone on run on youtube - but it won't run on my machine?
    I'm using Excel 2007 I don't know if that's got something to do with it.

    HTML Code: 

    Youtube:
    "#Excel VBA to Select the Next Empty Cell or Row - Macros"

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy to next row (not working)

    Try

    Please Login or Register  to view this content.
    To be sure it is good, do Ctrl +C and Ctrl + V

  11. #11
    Registered User
    Join Date
    09-03-2021
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    7

    Re: Copy to next row (not working)

    Thank-you for your perseverance, PC1
    It worked.
    it was the "l" in xlUp - I used No 1 not "L"

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Copy to next row (not working)

    it was the "l" in xlUp - I used No 1 not "L"
    Yes, what's why you had better to copy paste.
    In the other hand, as far as you are using the Range statement you will have a menu appearing when typing the ".": "Range("A" & Rows.Count)."
    Use this menu
    Enjoy Excel, and thx for the Rep ...
    Last edited by PCI; 09-05-2021 at 06:02 AM.

+ 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. Copy/Paste not working
    By mkmed in forum Excel General
    Replies: 3
    Last Post: 04-27-2018, 05:14 PM
  2. [SOLVED] Copy worksheets VBA not working
    By chika235 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2015, 08:34 PM
  3. Copy is not working from clipboard
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-21-2014, 08:11 AM
  4. Copy down not working
    By mma3824 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 02:30 PM
  5. Copy Tab to new tab not working
    By Jexcel2012 in forum Excel General
    Replies: 2
    Last Post: 01-18-2013, 07:09 PM
  6. Replies: 2
    Last Post: 08-17-2012, 08:16 AM
  7. Copy/PasteSpecial Not Working
    By Versaiteis in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-07-2009, 04:14 PM

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