+ Reply to Thread
Results 1 to 9 of 9

Copy Paste using VBA

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    mumbai
    MS-Off Ver
    Excel 2003
    Posts
    4

    Copy Paste using VBA

    I have a worksheet in which I would like to copy last cell of sheet2 to last cell of sheet1.

    To explain properly
    Sheet2 last cell is B100 (text is written)
    Sheet1 last cell is C150 (text is written)

    I would like to copy B100 to C150, that means eventhough C150 has already some text entered into it, after copy it would replace the text.

    As more data if I enter and whenever I run the VBA code the last cell should be changed accordingly, that means after several data the last cell in sheet2 may change to B300 and in sheet1 from C150 to C400, then B300 should be copied to C400 and so on

    I hope you must have understood what I am trying to say.

    I would like the above in VBA

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Copy Paste using VBA

    Hi.

    Try this code:

    Please Login or Register  to view this content.
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy Paste using VBA

    Try this....

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    01-29-2013
    Location
    mumbai
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copy Paste using VBA

    No sir the copy is not working properly

    For Eg. Sheet2 Cell B150 has text "Vehicle" in it
    This B150 text should be copied to sheet1 to Cell C200 even though C200 has previously some text written in it.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy Paste using VBA

    Quote Originally Posted by Maheshp072 View Post
    No sir the copy is not working properly
    Oops... corrected code is given below..

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-29-2013
    Location
    mumbai
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copy Paste using VBA

    Sir your code is still not working properly

    Let me explain again in detail

    Sheet2 cell B150 contains "Vehicle"
    This B150 that contains text should be copied to Sheet1 in cell C200

    Now if C200 already contains text "Keys" the "Keys" should be replaced by "Vehicle"

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy Paste using VBA

    It should work, not sure what you are doing wrong at your end

    Attach a sample workbook by showing what you tried for better understanding.

  8. #8
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Copy Paste using VBA

    I have checked both the code. It does what you are asking for. I don't understand why its not working for you?

  9. #9
    Registered User
    Join Date
    01-29-2013
    Location
    mumbai
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copy Paste using VBA

    I am sorry there was a mistake in copying your code to my file.
    It is working fine
    Thanks a lot

+ 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