How to paste VBA learning notes

Source: Internet
Author: User

Option Explicit'Worksheet.paste Method'Pastes the contents of the Clipboard onto the worksheet. 'an expression. Paste (Destination, Link)'An expression is a variable that represents a Worksheet object. Subpaste () Range ("B1:b6"). Copy Range ("C9")'This sentence is equal to the following two sentences, but the following two sentences are also usefulRange ("B1:b6"). Copy'copy Area no formulaSheet1.paste Range ("C9")'paste into cell C4End SubSubpaste 2 () Range ("C1:c6"). Copy'copy cells with formulasSheet3.paste'If you do not specify the Destination parameter, you must select the target region before using the method. End SubSubPaste 1 ()'This is interesting, in the way of the link, the mother changes, the sub-body also changedRange ("C1:c6"). Copy'Copy C1 cellsSheet3.paste,True 'of course, the target area must be selected before using this methodApplication.cutcopymode =True 'either write true or false here to remove the copy border'action to remove a border after copyEnd Sub
Paste selectively: range.pastespecial

In most cases we may just want to paste the area content instead of its format, or vice versa.

' Range.pastespecial method
' Pastes a range from the Clipboard into the specified area.
' Grammar
' Expression. PasteSpecial (Paste, operation, Skipblanks, transpose)
' Expression A variable that represents a Range object.

SubSelect Blame paste ()'do not paste the formula, just paste the contentRange ("C2:C10"). Copyrange ("D2"). PasteSpecial A '12 for paste values and number formatsEnd SubSubSelect Strange paste operation ()'2 = Paste as "add"'The final result is a total of two regions addedRange ("b2:b9"). Copyrange ("D2"). PasteSpecial,2Range ("c2:c9"). Copyrange ("D2"). PasteSpecial,2End SubSubSelect strange paste Skip Empty cell () Range ("b2:b9"). Copyrange ("E2"). PasteSpecial,,True 'Skip Ahead, select True at SkipblankEnd SubSubpaste the transpose () Range selectively ("a2:b9"). Copyrange ("A11"). PasteSpecial A, , ,TrueEnd Sub

Give the part:

How to paste VBA learning notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.