+ Reply to Thread
Results 1 to 12 of 12

Add copy paste macro to right-click menu

  1. #1
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Add copy paste macro to right-click menu

    Hello,

    I'm trying to write a code that copy's a range on sheet 3 into an active cell on sheet 1
    Basically my template is on sheet 3 and i want to right click on a field on sheet 1 and click "new entry"

    Thank You

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Add copy paste macro to right-click menu

    How about a keyboard shortcut? I mean you can add it to the right-click menu if you want, but keyboard short cuts are as easy as:
    1. Paste code into VB editor, save
    2. in Excel, press Alt+F8
    3. Select the macro, then press the Options Button
    4. type in the keyboard shortcut you want to use (you can even use multiple keys like Ctrl+Shift+R)


    Anyway, here's the code, adjust your range on sheet 3 as needed:


    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    I like the idea of having it on the right click menu
    I modified the code in the link you sent me and it works at adding the option to the right click menu but once i click it it tries to search for an old file location and gets an error?

    I've attached my spreadsheet to take a look
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Add copy paste macro to right-click menu

    Change the line in Workbook_Open to:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    That fixed it
    Thanks!

  6. #6
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    I have another question with this code
    What if instead of copying to the active cell i instead want to insert and shift rows down?

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Add copy paste macro to right-click menu

    Adjust the range as necessary.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    I tried that before but for some reason i loose the conditional formatting. With
    Please Login or Register  to view this content.
    i do not

  9. #9
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Add copy paste macro to right-click menu

    Not sure. I'm not losing conditional formatting in your original file, but that was testing with conditional formatting I made up.

  10. #10
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    Here take a look at this file. Both New entry and insert new entry are on the right click menu. you'll see what im talking about
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Add copy paste macro to right-click menu

    So it looks like the conditional formatting isn't being removed, it's just that it's still referencing the cells on Sheet3. Whereas copying the cells doesn't seem to include that sheet reference.

    See attached photos.

    Line 12-21 were inserted, you can see the sheet 3 references
    Line 22-31 were copied, you can see the lack of sheet 3 references

    Frankly, I don't know why it does that; I'm no expert in conditional formatting.

    I suggest starting a new thread with the title "Inserting vs. Copying cell with conditional formatting. Removing sheet reference when inserting cells from another sheet?"

    Explain a little what's going on and link to this thread so people can see what's been applied/tried. A link in this thread to your new thread would also be appreciated.

    Sorry I can't be of more help on this one, but I will follow your new thread, as I am curious as to why this happens and how to resolve it.

    Insert.pngCopy.png

  12. #12
    Forum Contributor
    Join Date
    12-18-2011
    Location
    long island
    MS-Off Ver
    365
    Posts
    236

    Re: Add copy paste macro to right-click menu

    I greatly appreciate your help and your drive.
    I feel like this is bugging you as much as its bugging me lol. i'll post the new thread tomorrow and we'll see what happens.

+ 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. Range copy method causes Right Click menu to disappear
    By llj69 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2015, 09:30 AM
  2. Right click cut, copy paste menu...
    By Chazrab in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2015, 10:55 AM
  3. A macro to right click a cell and select a item from the right click menu?
    By Peavey in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2014, 10:55 AM
  4. macro to copy and paste on scrollbar click
    By traderboy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 02:23 PM
  5. Right Click Menu - Adding (Paste Special)
    By Tirren in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-01-2012, 08:10 AM
  6. [SOLVED] Disabled Insert, Cut, Paste and others from Right click menu
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2012, 11:37 AM
  7. txtbox no right click copy menu available?
    By Craigm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2006, 11:33 AM

Tags for this Thread

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