Name

worksheet.PasteSpecial([Format], [Link], [DisplayAsIcon], [IconFileName], [IconIndex], [IconLabel], [NoHTMLFormatting])

Synopsis

Pastes the contents of the clipboard, including formatting, onto the specified worksheet.

Argument

Settings

Format

The format of the clipboard contents to paste, using one of the strings specified in the As list box of the Paste Special dialog box

Link

True to establish a link between the pasted clipboard contents and their source

DisplayAsIcon

True to display the pasted clipboard contents as an icon

IconFileName

The name of the file containing the icon to display

IconIndex

The numeric index of the icon within the icon file

IconLabel

The label to display with the icon

NoHTMLFormatting

True to remove all HTML formatting from the clipboard contents

The following code pastes the contents of the clipboard into cell D2 as a hyperlink:

Worksheets("WombatBattingAverages ").Range("D2").Select
ActiveSheet.PasteSpecial Format:= "Hyperlink"

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.