{"id":4349,"date":"2023-07-11T19:45:49","date_gmt":"2023-07-11T19:45:49","guid":{"rendered":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/"},"modified":"2023-07-11T19:45:49","modified_gmt":"2023-07-11T19:45:49","slug":"catene-di-concatenazione-vba","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/","title":{"rendered":"Come concatenare stringhe in vba (con esempi)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u00c8 possibile utilizzare i seguenti metodi per concatenare stringhe in VBA:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 1: concatena due stringhe<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C2<\/span> \") = Range(\" <span style=\"color: #ff0000;\">A2<\/span> \") &amp; Range(\" <span style=\"color: #ff0000;\">B2<\/span> \")\n<span style=\"color: #0000ff;\">End Sub\n<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Questo esempio concatener\u00e0 le stringhe nelle celle <strong>A2<\/strong> e <strong>B2<\/strong> e visualizzer\u00e0 il risultato nella cella <strong>C2<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 2: concatena due stringhe con un delimitatore<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C2<\/span> \") = Range(\" <span style=\"color: #ff0000;\">A2<\/span> \") &amp; \" \" &amp; Range(\" <span style=\"color: #ff0000;\">B2<\/span> \")\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Questo esempio concatener\u00e0 le stringhe nelle celle <strong>A2<\/strong> e <strong>B2<\/strong> con uno spazio tra le stringhe e visualizzer\u00e0 il risultato nella cella <strong>C2<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 3: concatenare due colonne con un delimitatore<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    <span style=\"color: #0000ff;\">Dim<\/span> i <span style=\"color: #0000ff;\">As<\/span> Integer\n\n    <span style=\"color: #0000ff;\">For<\/span> i = 2 <span style=\"color: #0000ff;\">To<\/span> 6\n      Cells(i, 3).Value = Cells(i, 1) &amp; \" <span style=\"color: #ff0000;\">_<\/span> \" &amp; Cells(i, 2)\n    <span style=\"color: #0000ff;\">Next<\/span> i\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Questo esempio concatener\u00e0 le stringhe negli intervalli <strong>A2:A6<\/strong> e <strong>B2:B6<\/strong> con un carattere di sottolineatura tra le stringhe e visualizzer\u00e0 i risultati nelle celle <strong>C2:C6<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Gli esempi seguenti mostrano come utilizzare nella pratica ciascuno di questi metodi.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio 1: concatenare due stringhe<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Possiamo creare la seguente macro per concatenare due stringhe:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C2<\/span> \") = Range(\" <span style=\"color: #ff0000;\">A2<\/span> \") &amp; Range(\" <span style=\"color: #ff0000;\">B2<\/span> \")\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Quando eseguiamo questa macro, riceviamo il seguente output:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34150 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/conc11.jpg\" alt=\"\" width=\"522\" height=\"414\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che le stringhe delle celle <strong>A2<\/strong> e <strong>B2<\/strong> sono state concatenate nella cella <b>C2<\/b> .<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio 2: concatenare due stringhe con un delimitatore<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Possiamo creare la seguente macro per concatenare due stringhe con uno spazio come delimitatore:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C2<\/span> \") = Range(\" <span style=\"color: #ff0000;\">A2<\/span> \") &amp; \" \" &amp; Range(\" <span style=\"color: #ff0000;\">B2<\/span> \")\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Quando eseguiamo questa macro, riceviamo il seguente output:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34151 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/conc12.jpg\" alt=\"\" width=\"507\" height=\"414\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che le stringhe nelle celle <strong>A2<\/strong> e <strong>B2<\/strong> sono state concatenate con uno spazio tra di loro e il risultato viene visualizzato nella cella <b>C2<\/b> .<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio 3: concatenare due colonne con un delimitatore<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Possiamo creare la seguente macro per concatenare le stringhe in due colonne con un carattere di sottolineatura come delimitatore:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubConcatStrings<\/span> ()\n    <span style=\"color: #0000ff;\">Dim<\/span> i <span style=\"color: #0000ff;\">As<\/span> Integer\n\n    <span style=\"color: #0000ff;\">For<\/span> i = 2 <span style=\"color: #0000ff;\">To<\/span> 6\n      Cells(i, 3).Value = Cells(i, 1) &amp; \" <span style=\"color: #ff0000;\">_<\/span> \" &amp; Cells(i, 2)\n    <span style=\"color: #0000ff;\">Next<\/span> i\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Quando eseguiamo questa macro, riceviamo il seguente output:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34152 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/conc13.jpg\" alt=\"\" width=\"525\" height=\"397\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che le stringhe nell&#8217;intervallo <strong>A2:A6<\/strong> e <strong>B2:B6<\/strong> sono state concatenate con un carattere di sottolineatura tra di loro e i risultati vengono visualizzati nell&#8217;intervallo <b>C2:C6<\/b> .<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come eseguire altre attivit\u00e0 comuni in VBA:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/vba-conta-le-occorrenze-di-caratteri-nella-stringa\/\" target=\"_blank\" rel=\"noopener\">VBA: come contare le occorrenze di caratteri in una stringa<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/vba-contiene-una-stringa\/\" target=\"_blank\" rel=\"noopener\">VBA: come verificare se una stringa contiene un&#8217;altra stringa<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/celle-di-conteggio-vba-con-testo-specifico\/\" target=\"_blank\" rel=\"noopener\">VBA: come contare le celle con testo specifico<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c8 possibile utilizzare i seguenti metodi per concatenare stringhe in VBA: Metodo 1: concatena due stringhe SubConcatStrings () Range(&#8221; C2 &#8220;) = Range(&#8221; A2 &#8220;) &amp; Range(&#8221; B2 &#8220;) End Sub Questo esempio concatener\u00e0 le stringhe nelle celle A2 e B2 e visualizzer\u00e0 il risultato nella cella C2 . Metodo 2: concatena due stringhe con [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Come concatenare stringhe in VBA (con esempi) - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come concatenare stringhe in VBA (con esempi) - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-11T19:45:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/conc11.jpg\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/\",\"url\":\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/\",\"name\":\"Come concatenare stringhe in VBA (con esempi) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-11T19:45:49+00:00\",\"dateModified\":\"2023-07-11T19:45:49+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come concatenare stringhe in vba (con esempi)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Come concatenare stringhe in VBA (con esempi) - Statorials","description":"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.","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:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/","og_locale":"it_IT","og_type":"article","og_title":"Come concatenare stringhe in VBA (con esempi) - Statorials","og_description":"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.","og_url":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/","og_site_name":"Statorials","article_published_time":"2023-07-11T19:45:49+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/conc11.jpg"}],"author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/","url":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/","name":"Come concatenare stringhe in VBA (con esempi) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-11T19:45:49+00:00","dateModified":"2023-07-11T19:45:49+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come concatenare stringhe in VBA, con diversi esempi.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/catene-di-concatenazione-vba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come concatenare stringhe in vba (con esempi)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4349"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=4349"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4349\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=4349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=4349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=4349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}