+ Reply to Thread
Results 1 to 4 of 4

VBA Macro for only pasting values OR match destination format

  1. #1
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    VBA Macro for only pasting values OR match destination format

    I have a spread sheet setup for people in my office to use with some conditional formatting, but when some people copy and paste items into the spreadsheet it's messing with the conditional format cell ranges.

    I currently have some code in for a macro when Ctrl+V is pressed to paste special > values which is a great work around so far. But on occasion some people will copy and paste between instances of excel, in which case I'd need it to paste special > match destination formatting. How can I also allow this in the code I already have?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA Macro for only pasting values OR match destination format

    Let's take a step back

    Is your problem that
    - they are pasting formulas into the cells
    - that they are removing conditional format rule on pasted cells
    - or both?

    Is it helpful to allow them to copy & paste - or would you prefer to prevent that from happening?

    When they are copying and pasting, are they pasting "one cell at a time" or a "range"?
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    Re: VBA Macro for only pasting values OR match destination format

    Quote Originally Posted by kev_ View Post
    Let's take a step back

    Is your problem that
    - they are pasting formulas into the cells
    - that they are removing conditional format rule on pasted cells
    - or both?

    Is it helpful to allow them to copy & paste - or would you prefer to prevent that from happening?

    When they are copying and pasting, are they pasting "one cell at a time" or a "range"?
    Hi Kev,

    I wouldn't want to stop them from copy and pasting as sometimes the text in the cell can be quite long so it would be pain to have to retype it all.

    It's essentially a calendar for everyone to fill in their tasks for the week, the weekday highlights depending on todays day with conditional formatting. But as they are copy and pasting between days it's messing with conditional formatting, and so random cells are also highlighting when they shouldn't be.

    They can either be copy and pasting one cell at a time or a range of cells depending how many tasks they're coping across.

    Hope this helps.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA Macro for only pasting values OR match destination format

    Give this a try - it worked for me

    Place this macro in the DESTINATION file
    Please Login or Register  to view this content.
    - select text in SOURCE file ( in another instance of Excel 2010)
    - {CTRL} + c
    - activate DESTINATION file
    - click on first cell in range
    - run the macro

    The text was formatted as per DESTINATION file

+ 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. Macro to only allow pasting of values and not format??
    By Celt in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 01-26-2021, 01:45 PM
  2. Restrict Pasting to Keep Destination Match Formatting Programmatically
    By gibbsa08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2016, 02:06 AM
  3. [SOLVED] Macro to format column cell as Time after pasting values collected from sheets
    By celias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2016, 05:09 PM
  4. [SOLVED] VBA: Looking for a Macro to Match and Copy from Source to Destination Sheet
    By AliGW in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2016, 03:16 AM
  5. pasting cell values matching destination formatting
    By vientito in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2014, 06:58 PM
  6. [SOLVED] Paste in "match destination format" macro code
    By Hopelesslylost in forum Excel General
    Replies: 6
    Last Post: 12-05-2012, 01:57 PM
  7. Replies: 1
    Last Post: 04-17-2006, 05:10 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