+ Reply to Thread
Results 1 to 5 of 5

disappearing values with simple code

  1. #1
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    disappearing values with simple code

    i had this sub created and attached it to a button within my spreadsheet

    Please Login or Register  to view this content.
    this worked perfectly. however i found a need that i wanted to expand upon the same button to move a similar set of data and i used this code:

    Please Login or Register  to view this content.
    however it does not work. the data in range e2:e7 will disappear and not paste into the n2:n7 range. i am very new to VBA and so im curious as to what may be the issue with this? is it just formatting or is there a deeper issue i am not understanding. thank you for any help.

    to clarify: i want to move both sets of data with one press of a button

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: disappearing values with simple code

    Hi for me it works. Are You sure that the names of sheets are correct?
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: disappearing values with simple code

    hmm. i must have had a typo. i retyped everything and it worked this time. thank you for quick response

  4. #4
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: disappearing values with simple code

    Quote Originally Posted by kamelkid2 View Post
    however it does not work. the data in range e2:e7 will disappear and not paste into the n2:n7 range.
    As written, you are telling excel to make your "E" range whatever your "N" range is. I think you just need to switch them around based on your explanation.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  5. #5
    Forum Contributor
    Join Date
    01-06-2011
    Location
    cleveland
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: disappearing values with simple code

    ah yes this makes sense now. i came back to this thread as i encountered the same issue again. my thought process was backwards on it.

+ 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