+ Reply to Thread
Results 1 to 14 of 14

Copy Highlighted Cell And Paste

Hybrid View

  1. #1
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Copy Highlighted Cell And Paste

    Hello. I am trying to create a code that will copy the selected cell information and paste it where I want it.

    Basically it is for a learner database I use at work, when I select John Smith (for example) I want it to copy his name and paste it into a fork lift booking form that I can print off.

    Thank you in advance.
    Last edited by samdegg; 08-27-2013 at 04:34 PM. Reason: Spelling

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copy Highlighted Cell And Paste

    The microsoft commands ctrl c and ctrl V will do that for you

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    Hi samdegg

    mehmetcik is correct
    The microsoft commands ctrl c and ctrl V
    will do that for you
    I'd guess there's something your not telling/showing us.

    What is it you have and what is it you wish it to be?

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the "Upload Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    SampleBook.xlsx

    Hello, I have created a spreadsheet to show what I want to do but (at the risk of sounding stupid) do not know how to upload it to this thread.

    EDIT: That's what I get for not reading instructions. I have now attached the file.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    Hi Sam

    Try this
    Option Explicit
    
    Sub Copy_Paste()
        ActiveCell.Copy Destination:=Range("G10")
    End Sub

  6. #6
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    I should of added that I want the copied cell to go to another sheet. I have just tried
    ActiveCell.Copy Destination:=Sheets("FLT Assessment Form")Range("C9")

    to no avail.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    Hi Sam

    You're missing a Dot (.)
    ActiveCell.Copy Destination:=Sheets("FLT Assessment Form")Range("C9")
    should be
    ActiveCell.Copy Destination:=Sheets("FLT Assessment Form").Range("C9")

  8. #8
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    I have just tried that code and I am getting "Run-time error '1004': Method 'Range' of object '_Global' failed"

  9. #9
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    Right, thank you very much.

    I have tried the new code and it is copying data over but not the correct data. Instead of copying B6 of sheet 2, it is copying G8 from sheet 1.

    Even if I try another cell other than B6 it still copies G8 from sheet 1.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    Hi Sam

    Don't know what to tell you without seeing what you have...

  11. #11
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    I have moved the button on sheet 1 and its working correctly now, thank you. I have moved some stuff around and the button will stay on sheet 1 now.

    One more thing, would it be possible to add into the code, something that would tell it once pasted switch to the sheet where the data has been pasted?

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    Sure

    Sheets("FLT Assessment Form").Activate

  13. #13
    Registered User
    Join Date
    09-02-2012
    Location
    Staffordshire, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Copy Highlighted Cell And Paste

    That is brilliant, thank you very much for your help.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy Highlighted Cell And Paste

    You're welcome...glad I could help...thanks for the Rep.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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 and Paste based on Red Highlighted Cells
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2013, 12:59 PM
  2. Copy a Row to another sheet of a cell in a column is highlighted
    By kdsanderson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-30-2013, 11:52 AM
  3. Replies: 2
    Last Post: 12-05-2012, 09:54 AM
  4. Macro Help! Copy/Paste Highlighted Row
    By TShelt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-16-2011, 12:30 PM
  5. [SOLVED] Drawn lines paste anywhere not on highlighted cell
    By Miss P in forum Excel General
    Replies: 0
    Last Post: 12-30-2005, 11:50 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