+ Reply to Thread
Results 1 to 5 of 5

Excel VBA Paste Special - replace contents of destination cells

  1. #1
    Sam via OfficeKB.com
    Guest

    Excel VBA Paste Special - replace contents of destination cells

    Hi All,

    I'm using Paste Special in a Macro to copy the format and column widths etc
    and overwrite some existing data in the destination cells.

    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False

    I receive an Information Alert message: "Do you want to replace the contents
    of the destination cells? Yes / No"

    How can I reply "Yes" to the Alert Message within the Macro to prevent user
    intervention?

    Thanks
    Sam

    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200604/1

  2. #2
    Jim Cone
    Guest

    Re: Excel VBA Paste Special - replace contents of destination cells

    Sam,
    You can't reply to it, but you can use the following to prevent
    the message from appearing...

    Application.DisplayAlerts = False

    Set this back to True before exiting the Sub.
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Sam via OfficeKB.com" <u4102@uwe>
    wrote in message news:5ee08e4c8ec2e@uwe...
    Hi All,
    I'm using Paste Special in a Macro to copy the format and column widths etc
    and overwrite some existing data in the destination cells.

    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False

    I receive an Information Alert message: "Do you want to replace the contents
    of the destination cells? Yes / No"
    How can I reply "Yes" to the Alert Message within the Macro to prevent user
    intervention?
    Thanks
    Sam

  3. #3
    Sam via OfficeKB.com
    Guest

    Re: Excel VBA Paste Special - replace contents of destination cells

    Hi Jim,

    Thank you very much for your assistance: that worked Great!

    Cheers
    Sam

    Jim Cone wrote:
    >Sam,
    >You can't reply to it, but you can use the following to prevent
    >the message from appearing...


    >Application.DisplayAlerts = False


    >Set this back to True before exiting the Sub.


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200604/1

  4. #4
    Registered User
    Join Date
    02-21-2010
    Location
    algeria
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Excel VBA Paste Special - replace contents of destination cells

    This is amrane

    Thank you so much for your e-mail


    BR

  5. #5
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Re: Excel VBA Paste Special - replace contents of destination cells

    Just used this code... worked great for me! Thank-you!

+ 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