{"id":2865,"date":"2018-08-08T12:33:19","date_gmt":"2018-08-08T12:33:19","guid":{"rendered":"http:\/\/officetuts.net\/excel\/?p=2865"},"modified":"2024-03-29T23:56:43","modified_gmt":"2024-03-29T23:56:43","slug":"copy-and-paste-values-with-vba","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/","title":{"rendered":"Copy and Paste Values With VBA"},"content":{"rendered":"\n

In this lesson, you find multiple examples of how to copy and paste values with VBA.<\/p>\n\n\n\n

Copy row or column between sheets with numbers<\/h2>\n\n\n\n

The following subroutine copies the first column (A) in the first sheet (\u201cSheet1\u201d) and pastes it into the first column of the second sheet (\u201cSheet 2\u201d).<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n
Sub CopyCol()\n   Sheets(1).Columns(1).Copy\n   Sheets(2).Columns(1).PasteSpecial xlAll\nEnd Sub<\/pre>\n\n\n\n
\"\"<\/figure>\n\n\n\n

And the second example. This time let\u2019s copy the first row.<\/p>\n\n\n\n

Sub CopyRow()\n   Sheets(1).Rows(1).Copy\n   Sheets(2).Rows(1).PasteSpecial xlAll\nEnd Sub<\/pre>\n\n\n\n
\"\"<\/figure>\n\n\n\n

Copy row or column between sheets with names<\/h2>\n\n\n\n

Often using numbers in selecting rows and column<\/a> may be very inefficient. That\u2019s why using names is usually a better idea. Of course, it does matter for sheets and columns, and not for rows because they use numbers anyway.<\/p>\n\n\n\n

Sub CopyCol()\n   Sheets(\"Sheet1\").Columns(\"A\").Copy\n   Sheets(\"Sheet2\").Columns(\"A\").PasteSpecial xlAll\nEnd Sub<\/pre>\n\n\n\n

Copy multiple rows or columns between sheets<\/h2>\n\n\n\n

An easy way to copy multiple adjacent columns is as follows. You have to use Range<\/strong>. This code copies the first three rows: A<\/strong>, B<\/strong>, and C<\/strong>.<\/p>\n\n\n\n

Sub CopyColMultiple ()\n   Sheets(\"Sheet1\").Range(\"A:C\").Copy\n   Sheets(\"Sheet2\").Range(\"A:C\").PasteSpecial xlAll\nEnd Sub<\/pre>\n\n\n\n

Copy Range<\/h2>\n\n\n\n

Apart from copying rows and columns, you can also copy cell ranges<\/a>.<\/p>\n\n\n\n

Sub CopyColRange()\n   Sheets(\"Sheet1\").Columns.Range(\"B2:C3\").Copy\n   Sheets(\"Sheet2\").Columns.Range(\"B2:C3\").PasteSpecial xlAll\nEnd Sub<\/pre>\n\n\n\n

This code copies cells B2<\/strong>, B3<\/strong>, C2<\/strong>, and C3<\/strong>.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Use a loop to copy (offset)<\/h2>\n\n\n\n

The following code copies cell from the first three columns and pastes them in B, C, and E (Offset = 1).<\/p>\n\n\n\n

Sub CopyColOffset()\nOffset = 1\n   For i = 1 To 3\n      Sheets(\"Sheet1\").Columns(i).Copy\n      Sheets(\"Sheet2\").Columns(i + Offset).PasteSpecial xlAll\n   Next i\nEnd Sub<\/pre>\n\n\n\n
\"\"<\/figure>\n\n\n\n

Copy without format (paste special)<\/h2>\n\n\n\n

So far we have been pasting data<\/a> with the exact formatting. But sometimes you don\u2019t want to keep the formatting. In order to change this code, we have to do a simple modification.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Copy and paste with transpose<\/h2>\n\n\n\n

In order to transpose the copied values set transpose to true.<\/p>\n\n\n\n

Sub CopyColTraspose()\n   Sheets(\"Sheet1\").Range(\"A1:C3\").Copy\n   Sheets(\"Sheet2\").Range(\"A1\").PasteSpecial Transpose:=True\nEnd Sub<\/pre>\n\n\n\n
\"\"<\/figure>\n","protected":false},"excerpt":{"rendered":"

In this lesson, you find multiple examples of how to copy and paste values with VBA. Copy row or column between sheets with…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[190],"yoast_head":"\nCopy and Paste Values With VBA<\/title>\n<meta name=\"description\" content=\"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy and Paste Values With VBA\" \/>\n<meta property=\"og:description\" content=\"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-08T12:33:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-29T23:56:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png\" \/>\n<meta name=\"author\" content=\"Tomasz Decker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Decker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\"},\"author\":{\"name\":\"Tomasz Decker\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"headline\":\"Copy and Paste Values With VBA\",\"datePublished\":\"2018-08-08T12:33:19+00:00\",\"dateModified\":\"2024-03-29T23:56:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\"},\"wordCount\":252,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png\",\"keywords\":[\"pinterest\"],\"articleSection\":[\"vba\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\",\"url\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\",\"name\":\"Copy and Paste Values With VBA\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png\",\"datePublished\":\"2018-08-08T12:33:19+00:00\",\"dateModified\":\"2024-03-29T23:56:43+00:00\",\"description\":\"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage\",\"url\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png\",\"contentUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy and Paste Values With VBA\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/officetuts.net\/excel\/#website\",\"url\":\"https:\/\/officetuts.net\/excel\/\",\"name\":\"\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/officetuts.net\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\",\"name\":\"Tomasz Decker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"caption\":\"Tomasz Decker\"},\"logo\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\"},\"description\":\"Spreadsheet and Python enthusiast.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy and Paste Values With VBA","description":"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/","og_locale":"en_US","og_type":"article","og_title":"Copy and Paste Values With VBA","og_description":"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.","og_url":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/","article_published_time":"2018-08-08T12:33:19+00:00","article_modified_time":"2024-03-29T23:56:43+00:00","og_image":[{"url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png"}],"author":"Tomasz Decker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tomasz Decker","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/"},"author":{"name":"Tomasz Decker","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"headline":"Copy and Paste Values With VBA","datePublished":"2018-08-08T12:33:19+00:00","dateModified":"2024-03-29T23:56:43+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/"},"wordCount":252,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png","keywords":["pinterest"],"articleSection":["vba"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/","url":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/","name":"Copy and Paste Values With VBA","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png","datePublished":"2018-08-08T12:33:19+00:00","dateModified":"2024-03-29T23:56:43+00:00","description":"Learn how to use VBA to copy and paste values in Excel with multiple examples. Copy columns or rows between sheets with ease. Get step-by-step instructions today.","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#primaryimage","url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png","contentUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/08\/copy-column-between-sheets.png"},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-and-paste-values-with-vba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"Copy and Paste Values With VBA"}]},{"@type":"WebSite","@id":"https:\/\/officetuts.net\/excel\/#website","url":"https:\/\/officetuts.net\/excel\/","name":"","description":"","publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/officetuts.net\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42","name":"Tomasz Decker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","caption":"Tomasz Decker"},"logo":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/"},"description":"Spreadsheet and Python enthusiast."}]}},"_links":{"self":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/2865"}],"collection":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/comments?post=2865"}],"version-history":[{"count":7,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/2865\/revisions"}],"predecessor-version":[{"id":12933,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/2865\/revisions\/12933"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=2865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=2865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=2865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}