{"id":5798,"date":"2017-04-04T01:49:18","date_gmt":"2017-04-04T01:49:18","guid":{"rendered":"https:\/\/wordherd.io\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/"},"modified":"2017-04-04T01:49:18","modified_gmt":"2017-04-04T01:49:18","slug":"using-vba-to-determine-the-page-size-and-required-column-width-in-excel","status":"publish","type":"post","link":"https:\/\/wordherd.io\/fr\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/","title":{"rendered":"Using VBA To Determine The Page Size And Required Column Width In Excel"},"content":{"rendered":"<p>As a result of Excel is primarily an software for knowledge evaluation, generally its presentation instruments endure by comparability. For instance, generally your knowledge has textual content of assorted size and may exceed the obtainable printing house.<\/p>\n<p>This text will present you find out how to calculate the proper column width to make sure the textual content matches inside the web page. A typical state of affairs is likely to be 2 commonplace columns after which a third column displaying feedback:<\/p>\n<p><pre>\n<br>Title, Date, Remark\n<br><\/pre>\n<\/p>\n<p>Though Excel has some instruments obtainable, such because the auto-fit function there&#8217;s nothing like being answerable for your software to get the end result you want.<\/p>\n<p>We&#8217;ll write some code which can calculate the width of the obtainable printing house, so we will decide the column widths to make sure environment friendly printing.<\/p>\n<p><strong>Calculating The Out there Printing Area On The Web page<\/strong><\/p>\n<p>One of many issues is that the models of measurement for web page measurement, margins and columns are inconsistent and we have to standardize the models earlier than figuring out the proper column width.<\/p>\n<p>A technique ahead is to transform all of the models into factors, somewhat than inches or centimeters. The web page measurement is initially returned in inches and is transformed, whereas left and proper margins are already in factors.<\/p>\n<p><pre>\n<br>pgWid = Utility.InchesToPoints(ActiveSheet.PageSetup.PaperSize)\n<br>leftMargin = ActiveSheet.PageSetup.LeftMargin\n<br>rightMargin = ActiveSheet.PageSetup.RightMargin\n<br><\/pre>\n<\/p>\n<p>Subsequently, some easy maths will give us the obtainable printing house and that is the width we have to match our third column into.<\/p>\n<p><pre>\n<br>content material = pgWid - leftMargin - rightMargin\n<br>col3=content-columns(1).Width - columns(2).Width\n<br><\/pre>\n<\/p>\n<p>Now we have the width required for column three in factors and that is superb, besides that column width is <strong>not<\/strong> measured in factors, however in Excel&#8217;s personal unit based mostly on font sizes. So, we&#8217;ll create an element to transform the width based mostly on the measurements in cell 1.<\/p>\n<p><pre>\n<br>' width in factors - learn solely.\n<br>pts = Columns(1).Width\n<br>' width in Excel's measurement unit\n<br>wd = Columns(1).ColumnWidth\n<br>issue = pts \/ wd\n<br>col3 = col3 \/issue\n<br><\/pre>\n<\/p>\n<p>Lastly we have now worth for the width of column three and we use that within the following code plus setting phrase wrap to <em>true<\/em> and the row peak to auto match.<\/p>\n<p><pre>\n<br>Columns(three).ColumnWidth = col3\n<br>Columns(three).wrapText=true\n<br>Rows(three).EntireRow.AutoFit\n<br><\/pre>\n<\/p>\n<p><strong>Abstract<\/strong><\/p>\n<p>Whereas the calculations for web page measurement and columns is usually a little complicated, it is worthwhile persevering. A very good data of how the totally different components of a spreadsheet are measured permits simpler preparation of knowledge for printing.<\/p>\n<div class=\"source\"><a href=\"http:\/\/ezinearticles.com\/?Using-VBA-To-Determine-The-Page-Size-And-Required-Column-Width-In-Excel&#038;id=7305778\">Source<\/a> par <a href=\"http:\/\/ezinearticles.com\/expert\/Andy_L_Gibson\/1382722\">Andy L Gibson<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>As a result of Excel is primarily an software for knowledge evaluation, generally its presentation instruments endure by comparability. For instance, generally your knowledge has textual content of assorted size and may exceed the obtainable printing house. This text will present you find out how to calculate the proper column width to make sure the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","inline_featured_image":false,"footnotes":""},"categories":[15],"tags":[200,595],"builders":[],"industry":[],"platform":[],"class_list":["post-5798","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-wordpress","tag-wordpress-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wordherd.io\/fr\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration\" \/>\n<meta property=\"og:description\" content=\"As a result of Excel is primarily an software for knowledge evaluation, generally its presentation instruments endure by comparability. For instance, generally your knowledge has textual content of assorted size and may exceed the obtainable printing house. This text will present you find out how to calculate the proper column width to make sure the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wordherd.io\/fr\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/\" \/>\n<meta property=\"og:site_name\" content=\"WordHerd WordPress Migration\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/wordherdio\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-04T01:49:18+00:00\" \/>\n<meta name=\"author\" content=\"WordHerd\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wordherdio\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"WordHerd\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\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:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/\"},\"author\":{\"name\":\"WordHerd\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/person\\\/373419b97c0fbc45a3a16462bdba0fac\"},\"headline\":\"Using VBA To Determine The Page Size And Required Column Width In Excel\",\"datePublished\":\"2017-04-04T01:49:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/\"},\"wordCount\":384,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\"},\"keywords\":[\"WordPress\",\"wordpress tutorial\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/\",\"url\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/\",\"name\":\"Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#website\"},\"datePublished\":\"2017-04-04T01:49:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wordherd.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using VBA To Determine The Page Size And Required Column Width In Excel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#website\",\"url\":\"https:\\\/\\\/wordherd.io\\\/\",\"name\":\"WordHerd WordPress Migration\",\"description\":\"Website Migration Services\",\"publisher\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wordherd.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\",\"name\":\"WordHerd WordPress Migration\",\"url\":\"https:\\\/\\\/wordherd.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wordherd.io\\\/wp-content\\\/uploads\\\/wordherd-trademark.png\",\"contentUrl\":\"https:\\\/\\\/wordherd.io\\\/wp-content\\\/uploads\\\/wordherd-trademark.png\",\"width\":1000,\"height\":315,\"caption\":\"WordHerd WordPress Migration\"},\"image\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/person\\\/373419b97c0fbc45a3a16462bdba0fac\",\"name\":\"WordHerd\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"caption\":\"WordHerd\"},\"sameAs\":[\"https:\\\/\\\/wordherd.io\",\"https:\\\/\\\/www.facebook.com\\\/wordherdio\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wordherd\",\"https:\\\/\\\/x.com\\\/wordherdio\"],\"url\":\"https:\\\/\\\/wordherd.io\\\/fr\\\/blog\\\/author\\\/wordherd\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration","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:\/\/wordherd.io\/fr\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/","og_locale":"fr_FR","og_type":"article","og_title":"Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration","og_description":"As a result of Excel is primarily an software for knowledge evaluation, generally its presentation instruments endure by comparability. For instance, generally your knowledge has textual content of assorted size and may exceed the obtainable printing house. This text will present you find out how to calculate the proper column width to make sure the [&hellip;]","og_url":"https:\/\/wordherd.io\/fr\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/","og_site_name":"WordHerd WordPress Migration","article_author":"https:\/\/www.facebook.com\/wordherdio\/","article_published_time":"2017-04-04T01:49:18+00:00","author":"WordHerd","twitter_card":"summary_large_image","twitter_creator":"@wordherdio","twitter_misc":{"\u00c9crit par":"WordHerd","Dur\u00e9e de lecture estim\u00e9e":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/#article","isPartOf":{"@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/"},"author":{"name":"WordHerd","@id":"https:\/\/wordherd.io\/#\/schema\/person\/373419b97c0fbc45a3a16462bdba0fac"},"headline":"Using VBA To Determine The Page Size And Required Column Width In Excel","datePublished":"2017-04-04T01:49:18+00:00","mainEntityOfPage":{"@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/"},"wordCount":384,"commentCount":0,"publisher":{"@id":"https:\/\/wordherd.io\/#organization"},"keywords":["WordPress","wordpress tutorial"],"articleSection":["WordPress"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/","url":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/","name":"Using VBA To Determine The Page Size And Required Column Width In Excel - WordHerd WordPress Migration","isPartOf":{"@id":"https:\/\/wordherd.io\/#website"},"datePublished":"2017-04-04T01:49:18+00:00","breadcrumb":{"@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wordherd.io\/blog\/using-vba-to-determine-the-page-size-and-required-column-width-in-excel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wordherd.io\/"},{"@type":"ListItem","position":2,"name":"Using VBA To Determine The Page Size And Required Column Width In Excel"}]},{"@type":"WebSite","@id":"https:\/\/wordherd.io\/#website","url":"https:\/\/wordherd.io\/","name":"Migration de WordHerd vers WordPress","description":"Services de migration de sites web","publisher":{"@id":"https:\/\/wordherd.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wordherd.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/wordherd.io\/#organization","name":"Migration de WordHerd vers WordPress","url":"https:\/\/wordherd.io\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/wordherd.io\/#\/schema\/logo\/image\/","url":"https:\/\/wordherd.io\/wp-content\/uploads\/wordherd-trademark.png","contentUrl":"https:\/\/wordherd.io\/wp-content\/uploads\/wordherd-trademark.png","width":1000,"height":315,"caption":"WordHerd WordPress Migration"},"image":{"@id":"https:\/\/wordherd.io\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/wordherd.io\/#\/schema\/person\/373419b97c0fbc45a3a16462bdba0fac","name":"WordHerd","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","caption":"WordHerd"},"sameAs":["https:\/\/wordherd.io","https:\/\/www.facebook.com\/wordherdio\/","https:\/\/www.linkedin.com\/company\/wordherd","https:\/\/x.com\/wordherdio"],"url":"https:\/\/wordherd.io\/fr\/blog\/author\/wordherd\/"}]}},"_links":{"self":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts\/5798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/comments?post=5798"}],"version-history":[{"count":0,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts\/5798\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/media?parent=5798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/categories?post=5798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/tags?post=5798"},{"taxonomy":"builders","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/builders?post=5798"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/industry?post=5798"},{"taxonomy":"platform","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/platform?post=5798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}