<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog de Philippe Vialatte &#187; excel</title>
	<atom:link href="https://blog.developpez.com/philippe/ptag/excel-2/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/philippe</link>
	<description></description>
	<lastBuildDate>Fri, 03 Jan 2014 15:12:09 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Excel : quelques fonctions sympas sur les tableaux</title>
		<link>https://blog.developpez.com/philippe/p12250/divers/excel-quelques-fonctions-sympas-sur-les-tableaux</link>
		<comments>https://blog.developpez.com/philippe/p12250/divers/excel-quelques-fonctions-sympas-sur-les-tableaux#comments</comments>
		<pubDate>Wed, 25 Sep 2013 11:45:00 +0000</pubDate>
		<dc:creator><![CDATA[Philippe Vialatte]]></dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[tableaux]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/philippe/?p=240</guid>
		<description><![CDATA[Dans la série “Excel et moi, je t’aime, moi non plus”, le sujet du jour concerne la manipulation des tableaux. On a tellement l’habitude, dans un langage de programmation moderne, de manipuler des tableaux d’objets, que, avec Excel, on s’attendrait a un comportement un peu civilisé. Du type : exposer une possibilité simple d’itérer sur les lignes d’un tableau, permettre de vider un tableau, ou de créer un tableau de manière propre …bah en fait, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Dans la série “Excel et moi, je t’aime, moi non plus”, le sujet du jour concerne la manipulation des tableaux.</p>
<p>On a tellement l’habitude, dans un langage de programmation moderne, de manipuler des tableaux d’objets, que, avec Excel, on s’attendrait a un comportement un peu civilisé.</p>
<p>Du type : exposer une possibilité simple d’itérer sur les lignes d’un tableau, permettre de vider un tableau, ou de créer un tableau de manière propre</p>
<p>…bah en fait, non…</p>
<p>Du coup, comme j’en avais besoin, 3 petites fonction qui font juste ça :</p>
<div id="codeSnippetWrapper">
<div id="codeSnippet">
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">Sub</span> ParcourirTable(sheet <span style="color: #0000ff">As</span> Worksheet,nomTable <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>)</pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre>    sheet.<span style="color: #0000ff">Select</span></pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">Dim</span> tbl <span style="color: #0000ff">As</span> ListObject</pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">Set</span> tbl = ActiveSheet.ListObjects(nomTable)</pre>
<p><!--CRLF--></p>
<pre>    </pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">Dim</span> row <span style="color: #0000ff">As</span> Range</pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">Dim</span> cell <span style="color: #0000ff">As</span> Range</pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">For</span> <span style="color: #0000ff">Each</span> row <span style="color: #0000ff">In</span> tbl.DataBodyRange.Rows</pre>
<p><!--CRLF--></p>
<pre>        <span style="color: #0000ff">For</span> <span style="color: #0000ff">Each</span> cell <span style="color: #0000ff">In</span> row.Cells</pre>
<p><!--CRLF--></p>
<pre>            Debug.Print cell.Value</pre>
<p><!--CRLF--></p>
<pre>        <span style="color: #0000ff">Next</span></pre>
<p><!--CRLF--></p>
<pre>        Debug.Print <span style="color: #006080">&quot;---&quot;</span></pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">Next</span></pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">End</span> <span style="color: #0000ff">Sub</span></pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">Sub</span> EffacerContenuTable(sheet <span style="color: #0000ff">As</span> Worksheet, nomTable <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>)</pre>
<p><!--CRLF--></p>
<pre>    </pre>
<p><!--CRLF--></p>
<pre>    sheet.<span style="color: #0000ff">Select</span></pre>
<p><!--CRLF--></p>
<pre>    </pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">With</span> ActiveSheet.ListObjects(nomTable )</pre>
<p><!--CRLF--></p>
<pre>        <span style="color: #0000ff">If</span> <span style="color: #0000ff">Not</span> .DataBodyRange <span style="color: #0000ff">Is</span> <span style="color: #0000ff">Nothing</span> <span style="color: #0000ff">Then</span></pre>
<p><!--CRLF--></p>
<pre>            .DataBodyRange.ClearContents</pre>
<p><!--CRLF--></p>
<pre>            .DataBodyRange.Delete</pre>
<p><!--CRLF--></p>
<pre>        <span style="color: #0000ff">End</span> <span style="color: #0000ff">If</span></pre>
<p><!--CRLF--></p>
<pre>    <span style="color: #0000ff">End</span> <span style="color: #0000ff">With</span></pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">End</span> <span style="color: #0000ff">Sub</span></pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">Sub</span> CreerTable(sheet <span style="color: #0000ff">As</span> Worksheet, nom <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>, adresse <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>)</pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></p>
<pre>    sheet.ListObjects.Add(xlSrcRange, range(adresse), , xlYes).Name = nom</pre>
<p><!--CRLF--></p>
<pre>    </pre>
<p><!--CRLF--></p>
<pre><span style="color: #0000ff">End</span> <span style="color: #0000ff">Sub</span></pre>
<p><!--CRLF--></p>
<pre>&#160;</pre>
<p><!--CRLF--></div>
</div>
<div id="codeSnippetWrapper"></div>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
