Last active
December 30, 2015 00:59
-
-
Save josheinstein/7752971 to your computer and use it in GitHub Desktop.
Paste Values, Formats, and Comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' You can tweak the code a bit to avoid the error that will | |
' occur if you try to paste without a current selection | |
Sub PasteVFC() | |
' | |
' PasteVFC Macro | |
' Pastes values, formats, and comments. | |
' | |
On Error Resume Next | |
Selection.PasteSpecial xlPasteValuesAndNumberFormats | |
Selection.PasteSpecial xlPasteComments | |
End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Steps to create: | |
' 1. Turn on the "developer" tab in the ribbon. | |
' 2. Copy some cell to the clipboard. | |
' 3. Click into an empty cell. | |
' 4. Click "record macro" on the developer tab. | |
' 5. Name it "PasteVFC" and choose to store it in "Personal Macro Workbook" (important) | |
' 6. Click "paste special" and choose "values & formats" | |
' 7. In the same cell, click "paste special" and choose "comments" | |
' 8. Click "stop recording" on the developer tab | |
' 9. Click "Visual Basic" on the developer tab and the macro code *should* look like below | |
' 10. Optionally, you can add this macro to the quick access toolbar | |
Sub PasteVFC() | |
' | |
' PasteVFC Macro | |
' Pastes values, formats, and comments. | |
' | |
' | |
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ | |
xlNone, SkipBlanks:=False, Transpose:=False | |
Selection.PasteSpecial Paste:=xlPasteComments, Operation:=xlNone, _ | |
SkipBlanks:=False, Transpose:=False | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment