{"id":3089,"date":"2018-09-22T17:30:39","date_gmt":"2018-09-22T17:30:39","guid":{"rendered":"http:\/\/officetuts.net\/excel\/?p=3089"},"modified":"2024-03-30T11:53:14","modified_gmt":"2024-03-30T11:53:14","slug":"copy-range","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/","title":{"rendered":"VBA copy range"},"content":{"rendered":"\n

There are a few ways you can copy a range in VBA. For example, you can copy only values or entire cells, including formatting.<\/p>\n\n\n\n

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

Copy a range<\/h2>\n\n\n\n

The easiest way to copy a bunch of cells is by entering ranges inside the code. The following code will copy the range A1:B8<\/strong> to D1:E8<\/strong>.<\/p>\n\n\n\n

Sub CopyRange()\n    Range(\"A1:B8\").Copy Range(\"D1:E1\")\nEnd Sub<\/pre>\n\n\n\n
\"\"<\/figure>\n\n\n\n

Copy a range to another worksheet<\/h2>\n\n\n\n

In order to use the following code, you have to create two sheets with the following names: Sheet1<\/strong> and Sheet2<\/strong> (or any other, just don\u2019t forget to change it inside the code). The following code copies cells from the range and pastes<\/a> them into the same range on the other sheet.<\/p>\n\n\n\n

Sub CopyRangeBetweenSheets()\n    Sheets(\"Sheet1\").Range(\"A1:B8\").Copy Sheets(\"Sheet2\").Range(\"A1:B8\")\nEnd Sub<\/pre>\n\n\n\n

Copy a range to another worksheet without formatting<\/h2>\n\n\n\n

So far we copied entire cells. If you want to copy just values, you can use the following code.<\/p>\n\n\n\n

Sub CopyRange()\n    Range(\"D1:E8\").Value = Range(\"A1:B8\").Value\nEnd Sub<\/pre>\n\n\n\n

The result will look like this.<\/p>\n\n\n\n

\"\"<\/figure>\n","protected":false},"excerpt":{"rendered":"

There are a few ways you can copy a range in VBA. For example, you can copy only values or entire cells, including…<\/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":"\nVBA copy range<\/title>\n<meta name=\"description\" content=\"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.\" \/>\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-range\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VBA copy range\" \/>\n<meta property=\"og:description\" content=\"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-22T17:30:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-30T11:53:14+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\"},\"author\":{\"name\":\"Tomasz Decker\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"headline\":\"VBA copy range\",\"datePublished\":\"2018-09-22T17:30:39+00:00\",\"dateModified\":\"2024-03-30T11:53:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\"},\"wordCount\":149,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png\",\"keywords\":[\"pinterest\"],\"articleSection\":[\"vba\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\",\"url\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\",\"name\":\"VBA copy range\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png\",\"datePublished\":\"2018-09-22T17:30:39+00:00\",\"dateModified\":\"2024-03-30T11:53:14+00:00\",\"description\":\"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage\",\"url\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png\",\"contentUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VBA copy range\"}]},{\"@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":"VBA copy range","description":"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.","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-range\/","og_locale":"en_US","og_type":"article","og_title":"VBA copy range","og_description":"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.","og_url":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/","article_published_time":"2018-09-22T17:30:39+00:00","article_modified_time":"2024-03-30T11:53:14+00:00","og_image":[{"url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png"}],"author":"Tomasz Decker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tomasz Decker","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/"},"author":{"name":"Tomasz Decker","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"headline":"VBA copy range","datePublished":"2018-09-22T17:30:39+00:00","dateModified":"2024-03-30T11:53:14+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/"},"wordCount":149,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png","keywords":["pinterest"],"articleSection":["vba"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/","url":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/","name":"VBA copy range","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png","datePublished":"2018-09-22T17:30:39+00:00","dateModified":"2024-03-30T11:53:14+00:00","description":"Learn how to copy ranges in VBA: values, cells, and formatting. Simple code examples included. Copy to the same or another worksheet.","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/vba\/copy-range\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#primaryimage","url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png","contentUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/09\/copy-range-example.png"},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/vba\/copy-range\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"VBA copy range"}]},{"@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\/3089"}],"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=3089"}],"version-history":[{"count":4,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/3089\/revisions"}],"predecessor-version":[{"id":12972,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/3089\/revisions\/12972"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=3089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=3089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=3089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}