+ Reply to Thread
Results 1 to 3 of 3

Macro to Paste Text only

  1. #1
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Macro to Paste Text only

    I have a protected workbook with various cells unlocked for editing.
    I would like to be able to add a macro to enable me to paste just text only into these cells when i choose to.
    I have used the VBA code below but it does not work all the time.
    Please Login or Register  to view this content.
    If i select text from outside the workbook then the text will be pasted.
    If i copy text from cells within the workbook i receive a Runtime error '1004':
    PasteSpecial method of Worksheet class failed


    Any ideas?

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Macro to Paste Text only

    This 'PasteSpecial' method is the method as it applies to the 'Worksheet' object, not to the 'Range' object. 'Cells' are 'Range' type objects.
    There is a different syntax for this, e.g.:
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 12-12-2017 at 02:17 PM.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro to Paste Text only

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

+ 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. [SOLVED] Macro to Copy and Paste Specific Text in Column A on the last line with Text in Column B?
    By D2S in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2017, 04:08 PM
  2. [SOLVED] how to extract letters from text and paste them in new row with macro?
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2017, 12:53 AM
  3. [SOLVED] Macro to search for text and paste data in other area
    By andyman3 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-08-2014, 09:01 AM
  4. Replies: 13
    Last Post: 11-29-2012, 08:25 PM
  5. Looping a macro to check text and then copy and paste
    By DannyJ in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 10:56 AM
  6. Macro Find Text, Copy & Paste Special
    By OneChiOnly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2009, 10:48 AM
  7. [SOLVED] Macro to Cut-And-Paste Text
    By whyloo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2005, 04:06 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