<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-18750876</id><updated>2024-03-14T05:16:53.341+01:00</updated><title type='text'>Iceberg Code</title><subtitle type='html'>Come and visit my Iceberg, where you&#39;ll find some useful code that &#xa;works (VB, Excel, T-SQL, JavaScript, ...) This is the place where &#xa;I&#39;d like to share my ideas with you.&#xa;&#xa;I just hope to have time to preserve my blog not to fuse too quick</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18750876.post-2329109414780382158</id><published>2009-07-22T14:11:00.008+02:00</published><updated>2009-07-22T18:34:03.049+02:00</updated><title type='text'>prova tabella</title><content type='html'>provo a mettere una tabella per veder se viene bene&lt;br /&gt;&lt;table border=&quot;1&quot; cellspacing=&quot;0&quot; bordercolor=&quot;#cccccc&quot; cellpadding=&quot;5&quot; width=&quot;500&quot; align=&quot;center&quot;&gt;&lt;tr&gt;&lt;td class=&quot;tit_tab&quot; bgcolor=&quot;#cccccc&quot; bordercolor=&quot;#cccccc&quot;&gt;campo1&lt;/td&gt;&lt;td class=&quot;tit_tab&quot; bgcolor=&quot;#e9e9e9&quot; bordercolor=&quot;#cccccc&quot;&gt;campo2&lt;/td&gt;&lt;td class=&quot;tit_tab&quot; bgcolor=&quot;#cccccc&quot; bordercolor=&quot;#cccccc&quot;&gt;campo3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td  style=&quot;color:#cccccc;&quot;&gt;&lt;span class=&quot;verde&quot;&gt;32&lt;/span&gt;&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;67&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;76&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;17&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;81&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;30&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;67&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;86&lt;/td&gt;&lt;td bordercolor=&quot;#cccccc&quot;&gt;71&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/2329109414780382158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/2329109414780382158' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/2329109414780382158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/2329109414780382158'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2009/07/prova-tabella.html' title='prova tabella'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-115847924330709992</id><published>2006-09-17T09:37:00.000+02:00</published><updated>2006-09-17T09:47:23.326+02:00</updated><title type='text'>Value of Covered Warrant across time</title><content type='html'>Some time I trade on stocks and CW.&lt;br /&gt;Usually CW are a robbery especially when they are close to the expiration date, but they are good trading tools because they:&lt;br /&gt;1) let you pay less commissions&lt;br /&gt;2) have an embedded stop loss (if you are not a disciplined trader)&lt;br /&gt;3) reduce trade size &lt;br /&gt;4) leverage the trade to increase the potential return (LOSS) of an investment.&lt;br /&gt;&lt;br /&gt;The big problem with CW is that &quot;time goes by&quot; so it is very important to know How long you can hold them and if it is the right time to trade them.&lt;br /&gt;&lt;br /&gt;For this reason here you can find the excel &lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/CW_Time_Value.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;CW_Time_Value.xls&lt;/A&gt; &lt;br /&gt;that calculate with Black-Sholes pricing model evolution of price in&lt;br /&gt;different market condition and time horizon.&lt;br /&gt;&lt;br /&gt;What did I add to the model that I can&#39;t find elsewhere? ... Estimation of Volatility&lt;br /&gt;The original formula need half dozen of variable input to work, but most of them are constants or easy to find, but Volatility is very difficult to get.&lt;br /&gt;For this reason I applied the  &lt;A HREF=&quot;http://en.wikipedia.org/wiki/Bisection_method&quot; target=&quot;_blank&quot;&gt;Bisection method&lt;/A&gt; to evaluate Volatility at a given period when both CW price and Underlying Asset Price are known (Open/close price).&lt;br /&gt;&lt;br /&gt;The idea behind the Bisection method (In two words) is to compare the output of a formula with the known result of the formula itself when all but one input are known.&lt;br /&gt;&lt;br /&gt;In this case we know all the input and the result (open price of the CW) and we want to measure the unknown Volatility.&lt;br /&gt;We know that Volatility should be inside the interval &gt;0% and &lt;1000% so we try the half point:&lt;br /&gt;500% &lt;br /&gt;If the formula output is higher than the open price of the CW we understand that the interval is 0-500%. So we go down to  250%, 125%, 62.5%, 31.25%, 15.625%, 7,8125%&lt;br /&gt;and the volatility should be higher than 7,8125% so now we go up: 11.71875%, 13.671875%, ...&lt;br /&gt;the volatility interval should be 13.671875% - 15.625%&lt;br /&gt;&lt;br /&gt;As you see we decrease very fast the order of magnitude of the interval (even if we start from a creasy value like 100,000%).&lt;br /&gt;We must stop this recursive testing when the difference of the calculated output and the know result of the formula is less than the significant decimal (0.0001)&lt;br /&gt;&lt;br /&gt;Here the formula to evaluate the embedded Volatility&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Function CwStimaVolatilitaData(ByVal ValoreCW As Single, ByVal ValoreSottostante As Single, ByVal StrikePrice As Single, ByVal Scadenza As Date, ByVal TassoBCE As Single, Optional ByVal Moltiplicatore As Single = 1, Optional ByVal CwCall As Boolean = True) As Single&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Application.Volatile&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim AnniResidui As Single, Volatilita As Single, DeltaVolatilita As Single, Distanza As Single, a As Single, b As Single, c As Single, d1 As Single, d2 As Single&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    AnniResidui = (Scadenza - Date) / 365&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Volatilita = 1000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    DeltaVolatilita = Volatilita / 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Distanza = 1000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Do Until Abs(Distanza) &lt; 0.0001&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Distanza = CwStimaValore(ValoreSottostante, StrikePrice, AnniResidui, TassoBCE, Volatilita, Moltiplicatore, CwCall) - ValoreCW&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        If Distanza &gt; 0 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;            Volatilita = Volatilita - DeltaVolatilita&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;            Volatilita = Volatilita + DeltaVolatilita&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    DeltaVolatilita = DeltaVolatilita / 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    i = i + 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Loop&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    CwStimaVolatilitaData = Volatilita&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/CW_Time_Value.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;b&gt;Download it Now!&lt;/b&gt;&lt;/A&gt; &lt;br /&gt;&lt;br /&gt;Enjoy it!</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/115847924330709992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/115847924330709992' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115847924330709992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115847924330709992'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/09/value-of-covered-warrant-across-time.html' title='Value of Covered Warrant across time'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-115136296824591746</id><published>2006-06-27T00:46:00.000+02:00</published><updated>2006-06-27T01:12:18.476+02:00</updated><title type='text'>Split &amp; Merge</title><content type='html'>This is part one of two post.&lt;br /&gt;When you work on your own, you don&#39;t care to divide you big workbook in a multitude&lt;br /&gt;of smallest files to deploy to tens of users that must see only they own piece.&lt;br /&gt;... and Excel become a nightmare. &lt;br /&gt;How do you split a 10 thousands row worksheet into 200 X 50 workbook? &lt;br /&gt;Or how do you split a workbook with 5 different sheets?&lt;br /&gt;I worked out this solution: &lt;br /&gt;&lt;A HREF=&quot;http://xoomer.alice.it/icebergcode/SplitExcelFile.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;SplitExcelFile.xls &lt;/A&gt;&lt;br /&gt;&lt;br /&gt;You just need to set:&lt;br /&gt;1) Which worksheet split, and the name of the field that must be split&lt;br /&gt;2) the list of value to split and&lt;br /&gt;3) the parametric name of all the output workbook.&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.alice.it/icebergcode/SplitExcelFile.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;Enjoy it!&lt;/A&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/115136296824591746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/115136296824591746' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115136296824591746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115136296824591746'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/06/split-merge.html' title='Split &amp; Merge'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-115075420614367526</id><published>2006-06-19T23:55:00.000+02:00</published><updated>2006-06-19T23:58:43.540+02:00</updated><title type='text'>TOC &amp; JS</title><content type='html'>I have posted few things and now it&#39;s time to add a TOC (Table of Content) to search faster all the contents.&lt;br /&gt;So I added some JavaScript to enjoy sorting. To get the code you can just &quot;view Source&quot;...&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.alice.it/icebergcode/IcebergSort.htm&quot; target=&quot;_blank&quot;&gt;Click to view TOC&lt;/A&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/115075420614367526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/115075420614367526' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115075420614367526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115075420614367526'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/06/toc-js.html' title='TOC &amp; JS'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-115035575860578530</id><published>2006-06-15T09:06:00.000+02:00</published><updated>2006-06-15T09:15:58.616+02:00</updated><title type='text'>If You like mp3 you gonna love this excel</title><content type='html'>After updating my previous &lt;A HREF=&quot;http://icebergcode.blogspot.com/2006/02/excel-list-file.html&quot; target=&quot;_blank&quot;&gt;Excel List File&lt;/A&gt;, I&#39;m trying to specialized it.&lt;br /&gt;So lets try this useful &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/MP3_Info.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;MP3_Info.xls&lt;/A&gt; excel that just find any mp3 on your PC and ...&lt;br /&gt;&lt;br /&gt;... get all TAGs info about any single file: Amazing!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/MP3_Info.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt; Enjoy it!&lt;/A&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/115035575860578530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/115035575860578530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115035575860578530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/115035575860578530'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/06/if-you-like-mp3-you-gonna-love-this.html' title='If You like mp3 you gonna love this excel'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114959650842812370</id><published>2006-06-06T14:21:00.000+02:00</published><updated>2006-06-06T14:27:54.970+02:00</updated><title type='text'>Most Useful Access Code</title><content type='html'>Maybe I&#39;m a little bit too enthusiastic about this module but I use it so often that I consider it the most useful ...&lt;br /&gt;&lt;br /&gt;The main idea is to store all the queries action in a table and run them from it.&lt;br /&gt;With a table that contain all kind of queries, you just need to sort and flag them as runable. &lt;br /&gt;&lt;br /&gt;Here the TR (track record) of the &quot;SQL_List&quot; table:&lt;br /&gt;SQL_ID         (counter)&lt;br /&gt;SP_NAME        (the name of the Stored Procedure)&lt;br /&gt;Run_it         (a flag to run or not them)&lt;br /&gt;OrderSQL       (the order sorting)&lt;br /&gt;What_is_doing  (description for portability)&lt;br /&gt;SQL            (The SQL of the action query)&lt;br /&gt;&lt;br /&gt;What is an Action Query? &lt;br /&gt;The one that does not just show records and does something like update, delete, append, create, ...&lt;br /&gt;  &lt;br /&gt;What is a SP (Stored Procedure)? &lt;br /&gt;When you start using SQL-server you can really understand it. In short is a list of action, a program to get the result you want&lt;br /&gt;&lt;br /&gt;Back to the SQL_List, here an example of how to query it:&lt;br /&gt;SELECT SQL FROM SQL_List WHERE SP_NAME=&quot;Test&quot; AND Run_it=1 ORDER BY OrderSQL;&lt;br /&gt;&lt;br /&gt;To better use it you should use a Macro, that contain just one Action:&lt;br /&gt;RunCode [ExecListOfQueries ( &quot;SELECT SQL FROM SQL_List WHERE SP_NAME=&#39;Test&#39; AND Run_it=1 ORDER BY OrderSQL&quot;)]&lt;br /&gt;&lt;br /&gt;And here the core of the entire trick you need a module with the code:&lt;br /&gt;ModuleName: UsefullAccessCode&lt;br /&gt;The code is very simple:&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Function ExecListOfQueries(MySQLList)&lt;br /&gt;&#39; stop warning&lt;br /&gt;DoCmd.SetWarnings False&lt;br /&gt;Dim dbs As DAO.Database, rst As DAO.Recordset, TempSQL&lt;br /&gt;Set dbs = CurrentDb&lt;br /&gt;&lt;br /&gt;&#39; The list of queries&lt;br /&gt;Set rst = dbs.OpenRecordset(MySQLList)&lt;br /&gt;&#39; if there are some records loop the result&lt;br /&gt;If rst.EOF = False And rst.BOF = False Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    rst.MoveFirst&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Do While rst.EOF = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; loop to Execute all the queries&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; replace double quote with single one to avoid error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        TempSQL = Replace(Replace(rst.Fields(0).Value, &quot;&quot;&quot;&quot;, &quot;&#39;&quot;), vbCrLf, &quot; &quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;Debug.Print TempSQL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        DoCmd.RunSQL TempSQL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    rst.MoveNext&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Loop&lt;br /&gt;End If&lt;br /&gt;rst.Close&lt;br /&gt;Set rst = Nothing&lt;br /&gt;dbs.Close&lt;br /&gt;Set dbs = Nothing&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;br /&gt;&lt;br /&gt;In this example &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/Run_SQL_List.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;b&gt;Run_SQL_List.mdb&lt;/b&gt;&lt;/A&gt;  you get all you need to test the code&lt;br /&gt;&lt;br /&gt;The thing I most appreciate in this trick is the portability and flexibility.&lt;br /&gt;... You can store all the queries in a single DB and use linked table to the &quot;SQL_List&quot; table, so it&#39;s easier to reuse queries from a project to another &lt;br /&gt;... Or in ASP project you can change queries without changing the code.&lt;br /&gt;... Most of all, the queries stay in a single place!&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/Run_SQL_List.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;b&gt;Download it Now!&lt;/b&gt;&lt;/A&gt; &lt;br /&gt;&lt;br /&gt;Enjoy it!</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114959650842812370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114959650842812370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114959650842812370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114959650842812370'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/06/most-useful-access-code.html' title='Most Useful Access Code'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114698606206325287</id><published>2006-05-07T09:12:00.000+02:00</published><updated>2006-05-09T00:20:24.800+02:00</updated><title type='text'>Most used balls in Milan</title><content type='html'>&lt;a href=&quot;http://photos1.blogger.com/blogger/5121/1842/320/MilanoBullballsXS.jpg&quot;&gt;&lt;img style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5121/1842/160/MilanoBullballsXS.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/MilanoBullballsS.JPG&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;Click to Download a bigger Image&lt;/A&gt;&lt;BR&gt;&lt;br /&gt;Put your heel in the bull&#39;s balls and make a full turn on your heel.&lt;br /&gt;This will bring you good luck!&lt;br /&gt;- Mosaics on the ground in the center of Galleria Vittorio Emanuele II (near Duomo)&lt;br /&gt;Remarks: paper airplane flies to North close to Google&#39;s balls&lt;br /&gt;&lt;br /&gt;45°27&#39;56.18&quot;N&lt;br /&gt;9°11&#39;19.82&quot;E&lt;br /&gt;&lt;br /&gt;For more info:&lt;br /&gt;&lt;a href=&quot;http://www.google.it/search?q=milan+bull%27s+balls&quot; target=&quot;_blank&quot;&gt;Search Google EN&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.google.it/search?q=milano+palle+del+toro&quot; target=&quot;_blank&quot;&gt;Search Google IT&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://bbs.keyhole.com/ubb/showthreaded.php?Cat=0&amp;Board=EarthTourism&amp;amp;Number=411169&quot; target=&quot;_blank&quot;&gt;Original Google Earth Post&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114698606206325287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114698606206325287' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114698606206325287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114698606206325287'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/05/most-used-balls-in-milan.html' title='Most used balls in Milan'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114608953013951463</id><published>2006-04-27T00:02:00.000+02:00</published><updated>2006-04-27T00:12:10.156+02:00</updated><title type='text'>Self Query Excel</title><content type='html'>This is just a simple but useful function to self query Excel.&lt;br /&gt;This mean that once you insert a named range you can query it,&lt;br /&gt;with this Array Function:&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Function SQL2Range(MySQL As String)&lt;br /&gt;&#39;Example: =SQL2Range(&quot;SELECT * FROM MyRange&quot;)&lt;br /&gt;&#39;On Error Resume Next   &#39; Enable error-handling routine.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim objRsExcel As Object, sConn As String, strExcelPath As String, strExcelFileName As String, output&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Set objRsExcel = CreateObject(&quot;ADODB.Recordset&quot;)&lt;br /&gt;   &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    strExcelPath = ThisWorkbook.Path &amp; &quot;\&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    strExcelFileName = ThisWorkbook.Name&lt;br /&gt;    &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    objRsExcel.CursorLocation = 3&lt;br /&gt;&lt;br /&gt;&#39;    objRsExcel.CursorType = 0 &#39;adOpenForwardOnly&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    objRsExcel.CursorType = 0 &#39;adOpenStatic&lt;br /&gt;&#39;    objRsExcel.CursorType = 0 &#39;adOpenForwardOnly&lt;br /&gt;&#39;    objRsExcel.CursorType = 0 &#39;adOpenForwardOnly&lt;br /&gt;&#39;    objRsExcel.LockType = 1&lt;br /&gt;    &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    sConn = &quot;DRIVER=Microsoft Excel Driver (*.xls);&quot; &amp; &quot;DBQ=&quot; &amp; strExcelPath &amp; strExcelFileName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    objRsExcel.Open MySQL, sConn&lt;br /&gt;        &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    output = objRsExcel.GetRows()&lt;br /&gt;       &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    objRsExcel.Close&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Set objRsExcel = Nothing&lt;br /&gt;&lt;br /&gt;SQL2Range = Application.WorksheetFunction.Transpose(output)&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;Array Function are the one inserted in a range with Shift+Control+Enter</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114608953013951463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114608953013951463' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114608953013951463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114608953013951463'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/04/self-query-excel.html' title='Self Query Excel'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114473676584603016</id><published>2006-04-11T08:25:00.000+02:00</published><updated>2006-04-11T08:26:05.883+02:00</updated><title type='text'>Add a Menu to a Excel Menu Bar</title><content type='html'>In the &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/AddMenu.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;AddMenu.xls &lt;/A&gt; file you find a usefull worksheet&lt;br /&gt;where you can set a personalised drop down Menu with all the commands to control your application.&lt;br /&gt;&lt;br /&gt;This tool is full of tips and tricks in order to be as flexible as possible,&lt;br /&gt;you don&#39;t need to modify the core of the code to change the menu&lt;br /&gt;All the interface and control stay in the &quot;MenuSheet&quot; worksheet.&lt;br /&gt;&lt;br /&gt;Let me explain my VBA way of Coding.&lt;br /&gt;1) Let Excel do 99% of the work, so with little code you get great Result&lt;br /&gt;2) Save all the variable in the worksheet, avoid constants and var inside the code&lt;br /&gt;3) Let Spreadsheet and VBA communicate with Named Range&lt;br /&gt;4) Use dynamic range to let expand the universe&lt;br /&gt;5) Give the end user a lot of drop down menu in cells to avoid error&lt;br /&gt;6) Copy and Paste ... Someone already did it&lt;br /&gt;7) Divide and conquer ... small piece of code are smarter&lt;br /&gt;&lt;br /&gt;That&#39;s said let see how to implement it in the real world&lt;br /&gt;When you open &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/AddMenu.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;AddMenu.xls &lt;/A&gt; workbook you are faced with a setting worksheet&lt;br /&gt;where you can set everything to build your own Menu.&lt;br /&gt;&lt;br /&gt;The table on the left contains all the info to give name and action to any button&lt;br /&gt;The table can contain as many rows as you like (use dynamic range)&lt;br /&gt;&lt;br /&gt;Then you have 3 variable on the top centre&lt;br /&gt;the first 2 are to set the name and the position of the new Menu&lt;br /&gt;The last one is a service variable that set the visibility&lt;br /&gt;of the worksheet itself. When do you use this var? When you are done with all the&lt;br /&gt;settings and you don&#39;t need anymore to show the setting worksheet, you can hide it&lt;br /&gt;and give all to the final user.&lt;br /&gt;&lt;br /&gt;The BarName Var can be chosen in a drop down menu, so you need a list of items.&lt;br /&gt;The list is dynamic and refers to a named range.&lt;br /&gt;&lt;br /&gt;So on the Excel side we are almost ready,&lt;br /&gt;now lets give a name to all the ranges (I dont&#39; have fantasy):&lt;br /&gt;&lt;br /&gt;CaptionAction (table with list of all buttons - Dynamic)&lt;br /&gt;BarName       (where to put the new Menu)&lt;br /&gt;MenuName      (new Menu&#39; name)&lt;br /&gt;SheetVisible  (to set the sheet visible)&lt;br /&gt;ListCommandBars (all the CommandBar Name - Dynamic)&lt;br /&gt;&lt;br /&gt;Why do I use named range? Why don&#39;t use absolute address? &lt;br /&gt;Because VBA does not update if you change the position of a $A$1 &lt;br /&gt;style range. That&#39;s happen if you add/remove row/column&lt;br /&gt;or you just move the cell with the data. &lt;br /&gt;But if you give name to a range now, it&#39;s Excel that link the name&lt;br /&gt;to the absolute position and when VBA recall it&#39;s an excel task to do&lt;br /&gt;things right.&lt;br /&gt;How to name range? there are 2 way the fast one and the slow one&lt;br /&gt;Fast one is select a 2 column row range and follow the menus &lt;br /&gt;[Insert][Name][Create]...&lt;br /&gt;The slowest is [Insert][Name][Define].&lt;br /&gt;Use the first when you have a list of Var (named on the left)&lt;br /&gt;Use the second when you have a table to be named or &lt;br /&gt;you want to build a Dynamic Named Range.&lt;br /&gt;&lt;br /&gt;Setting a Dynamic Named Range is just a matter of Offset:&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;=MenuSheet!$A$2:OFFSET(MenuSheet!$A$2;COUNTA(MenuSheet!$A$2:$A$65536)-1;2)&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;It means that the table start at cell A2 and finish 3 column on the right (;2)&lt;br /&gt;and down how many rows are not empty on the first column.&lt;br /&gt;Once understand the logic, you can adapt to any direction (not just down)&lt;br /&gt;&lt;br /&gt;To set the BarName Var you need to Populate the list of all CommandBars Names, there is a little sub:&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Sub SetListCommandBars()&lt;br /&gt;&#39; This sub need to refer to the ListCommandBars named range&lt;br /&gt;&#39; work faster&lt;br /&gt;Application.ScreenUpdating = False&lt;br /&gt;&#39; get the first cell of the &quot;ListCommandBars&quot; range&lt;br /&gt;Set MyRange = Range(&quot;ListCommandBars&quot;).Cells(1)&lt;br /&gt;&#39; empty the range&lt;br /&gt;Range(&quot;ListCommandBars&quot;).Clear&lt;br /&gt;&#39; populate the range with all CommandBars Name&lt;br /&gt;For i = 1 To CommandBars.Count&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyRange.Offset(i - 1) = CommandBars(i).Name&lt;br /&gt;Next i&lt;br /&gt;Application.ScreenUpdating = True&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The sub to work needs the &quot;ListCommandBars&quot; named range in the worksheet:&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;=MenuSheet!$M$2:OFFSET(MenuSheet!$M$2;COUNTA(MenuSheet!$M$2:$M$65536)-1;0)&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Now lets Code!&lt;br /&gt;In the VBA Module there are a lot of small functions and sub to get ready to go&lt;br /&gt;and to check some error, but the core is the one that&#39;s add the new menu and all&lt;br /&gt;the buttons in it:&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Sub AddMenu()    &#39;create a new menu item with all the subMenu&lt;br /&gt;SetVar &#39;Take all the Var from the worksheet and makes avaibale in VBA&lt;br /&gt;Dim i As Integer&lt;br /&gt;&#39; If the menu already exists just exit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If MenuExists(BarName, MenuName) Then Exit Sub&lt;br /&gt;&#39; The menu does not exists so add it ...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Set mypopup = CommandBars(BarName).Controls.Add(Type:=msoControlPopup)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    mypopup.Caption = MenuName&lt;br /&gt;&lt;br /&gt;&#39; Add the SubMenu&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For Each Cell In CaptionActionFirstCol&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; if you preffer, you can avoid double names!&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If Len(Cell.Value) &gt; 0 And Not SubMenuExists(BarName, MenuName, Cell.Value) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;If Len(Cell.Value) &gt; 0 Then &#39;simplest one&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Set myitem = mypopup.Controls.Add(Type:=msoControlButton)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        With myitem&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;            .Caption = Cell.Value&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;            If Len(Cell.Offset(0, 1).Value) &gt; 0 Then .OnAction = Cell.Offset(0, 1).Value&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;            If Cell.Offset(0, 2).Value &gt; 0 Then .FaceId = Cell.Offset(0, 2).Value&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        End With&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next Cell&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;It looks very simple and it is, but remember that 99% of the work&lt;br /&gt;has been done by Excel!&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/AddMenu.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;b&gt;Download it Now!&lt;/b&gt;&lt;/A&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114473676584603016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114473676584603016' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114473676584603016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114473676584603016'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/04/add-menu-to-excel-menu-bar.html' title='Add a Menu to a Excel Menu Bar'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114384157016706260</id><published>2006-03-31T23:45:00.000+02:00</published><updated>2006-04-01T03:03:53.400+02:00</updated><title type='text'>Barcode within Excel</title><content type='html'>It could happen one day that you need to print a Barcode.&lt;br /&gt;Well in the &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/Barcode.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;Barcode.xls &lt;/A&gt; files you can get all you need to do it within Excel.&lt;br /&gt;&lt;br /&gt;First you need to install the Barcode Fonts (in the file you find them - &quot;Free 3 of 9&quot; &amp; &quot;Free 3 of 9 Extended&quot; The origin of the fonts could be lost)&lt;br /&gt;&lt;br /&gt;How To add a new font to your computer?&lt;br /&gt;&lt;br /&gt;1. Click Start, point to Settings, click Control Panel, and then double-click Fonts. &lt;br /&gt;2. On the File menu, click Install New Font. &lt;br /&gt;3. Click the drive, and then click the folder that contains the fonts you want to add. &lt;br /&gt;4. Click the font you want to add. &lt;br /&gt;&lt;br /&gt;Notes &lt;br /&gt;* To select more than one font to add, hold down the CTRL key, and then click each of the fonts you want. &lt;br /&gt;&lt;br /&gt;* For TrueType, Raster, or Adobe Type 1 fonts, you can also add the font by dragging the appropriate files to the Fonts folder. If you want to see the file extensions in Windows Explorer, click View, click Options, and then click the View tab. Click to clear the Hide file extensions for known file types check box. This works only for fonts that are not in the Fonts folder. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now you are ready to translate all your code in a Barcode, but before you have to add a checksum to your original code. To do this you&#39;ll find 3 function that calculate the correct code: Append_EAN_Checksum, Format_Code128 and Format_UPC_String&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/Barcode.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;B&gt;Download it now&lt;/B&gt;&lt;/A&gt;&lt;br /&gt;As usual if you prefer to read the code you can do it below:&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;&#39;EAN -13&lt;br /&gt;&#39;EAN-13 is used world-wide for marking retail goods. &lt;br /&gt;&#39;The symbol encodes 13 characters: the first two or three are a country code which &lt;br /&gt;&#39;identify the country in which the manufacturer is registered (not necessarily where &lt;br /&gt;&#39;the product is actually made).  The country code is followed by 9 or 10 data digits &lt;br /&gt;&#39;(depending on the length of the country code) and a single digit checksum. 2-digit &lt;br /&gt;&#39;and 5-digit supplemental barcodes may be added for a total of 14 or 17 data digits.&lt;br /&gt;&#39;&lt;br /&gt;&#39;The Uniform Code Council (the organization which issues retail codes in the USA) &lt;br /&gt;&#39;has announced that January 1, 2005 will be the date by which all retail scanning &lt;br /&gt;&#39;systems in the USA must be able to accept the EAN-13 symbol as well as the standard &lt;br /&gt;&#39;UPC-A. This change will eliminate the need for manufacturers who export goods to &lt;br /&gt;&#39;the US and Canada to double-label their products.&lt;br /&gt;&#39;&lt;br /&gt;&#39;The checksum is a Modulo 10 calculation:&lt;br /&gt;&#39;&lt;br /&gt;Add the values of the digits in the even-numbered positions: 2, 4, 6, etc.&lt;br /&gt;Multiply this result by 3.&lt;br /&gt;Add the values of the digits in the odd-numbered positions: 1, 3, 5, etc.&lt;br /&gt;Sum the results of steps 2 and 3.&lt;br /&gt;The check character is the smallest number which, when added to the result in step4, produces a multiple of 10.&lt;br /&gt;Example: Assume the barcode data = 001234567890&lt;br /&gt;&lt;br /&gt;0 + 2 + 4 + 6 + 8 + 0 = 20&lt;br /&gt;20 * 3 = 60&lt;br /&gt;0 + 1 + 3 + 5 + 7 + 9 = 25&lt;br /&gt;60 + 25 = 85&lt;br /&gt;85 + X = 90 (nearest equal or higher multiple of 10), therefore X = 5 (checksum)&lt;br /&gt;Here is a sample Visual Basic function to calculate the checksum:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function Append_EAN_Checksum(RawString As String)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Position As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Checksum As Integer&lt;br /&gt;    &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Checksum = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For Position = 2 To 12 Step 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;          Checksum = Checksum + Val(Mid$(RawString, Position, 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next Position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Checksum = Checksum * 3&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For Position = 1 To 11 Step 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;          Checksum = Checksum + Val(Mid$(RawString, Position, 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next Position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Checksum = Checksum Mod 10&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Checksum = 10 - Checksum&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If Checksum = 10 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;          Checksum = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Append_EAN_Checksum = RawString &amp; Format$(Checksum, &quot;0&quot;)&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&#39;Calculating a Code 128 Barcode Checksum in Access Basic&lt;br /&gt;&#39;This bit of Access Basic (same as Visual Basic) will calculate a Code 128 Modulo 103 checksum. &lt;br /&gt;&#39;Barcode fonts from different publishers may map the some characters to &lt;br /&gt;&#39;different locations, so be sure to check.&lt;br /&gt;&lt;br /&gt;Function Format_Code128(InString As String) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Sum As Integer, i As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Checksum As Integer, Checkchar As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim MyString As String, CVal As Integer&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Initialize running total with value of&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Subset B start character&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Sum = 104&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Scan the string and add character value times position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For i = 1 To Len(InString)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; Copy one character from InString position i to MyString&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        MyString = Mid$(InString, i, 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; Get the numeric value of the character and subtract&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; 32 to shift (the space character, ASCII value 32, has&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; a numeric value of 0 as far as Code 128 is concerned)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        CVal = Asc(MyString) - 32&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39; Add the weighted value into the running sum&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Sum = Sum + (CVal * i)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Calculate the Modulo 103 checksum&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Checksum = Sum Mod 103&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Now convert this number to a character.  This conversion&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; takes into account the particular mapping of the font&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; being used (this example is for the font published by&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Azalea Software.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If CheckDigit = 0 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Checkchar = 174&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    ElseIf CheckDigit &lt; 94 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Checkchar = CheckDigit + 32&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Checkchar = CheckDigit + 71&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Now format the final output string: start character,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; data, check character, and stop character&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyString = Chr(162) + InString + Chr(Checkchar) + Chr(164)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Format_Code128 = MyString&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&#39;UPC retail codes require a Modulo 10 check digit.&lt;br /&gt;&#39;This sample code accepts the UPC number, calculates the check digit,&lt;br /&gt;&#39;and returns the finished string.&lt;br /&gt;&#39;&lt;br /&gt;&#39;The general method involves adding up the digits in the odd-numbered&lt;br /&gt;&#39;positions and multiplying that sum by 3; then adding to that result&lt;br /&gt;&#39;the values of the digits in the even-numbered positions.&lt;br /&gt;&#39;Divide this result by 10 and subtract the remainder from 10.&lt;br /&gt;&#39;If the result is equal to 10, set it to zero; otherwise this is the check digit.&lt;br /&gt;&lt;br /&gt;Function Format_UPC_String(InString As String) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim OutString As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Multiplier As Integer, Sum As Integer, i As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim CheckDigit As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;   Initialize the sum to zero&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Sum = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;   Add up the values of digits in the odd-numbered positions&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For i = 1 To Len(InString) Step 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Sum = Sum + Val(Mid$(InString, i, 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;   Multiply this result by 3, then add in the values of&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;   the digits in the even-numbered positions&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Sum = Sum * 3&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    For i = 2 To Len(InString) Step 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        Sum = Sum + Val(Mid$(InString, i, 1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Next i&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;   Now calculate the Modulo 10 check digit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    CheckDigit = Sum Mod 10&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    CheckDigit = 10 - CheckDigit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If CheckDigit = 10 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        CheckDigit = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    OutString = InString + Format$(CheckDigit)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Format_UPC_String = OutString&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114384157016706260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114384157016706260' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114384157016706260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114384157016706260'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/barcode-within-excel.html' title='Barcode within Excel'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114383817842074707</id><published>2006-03-31T22:49:00.000+02:00</published><updated>2006-04-01T02:42:11.636+02:00</updated><title type='text'>String 2 Morse</title><content type='html'>This is a function to translate any String in Morse Code,&lt;br /&gt;I don&#39;t know if it is a useful function, but if you are&lt;br /&gt;starting to study VBA, it&#39;s a nice code to read&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Function txt2morse(ByVal text As String) As String&lt;br /&gt;Dim Letters As String, Morse As String, arrMorse() As String, i As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Letters = &quot; ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?/:&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Morse = &quot; ,.-,-...,-.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..,--,-.,---,.--.,--.-,.-.,...,-,..-,...-,.--,-..-,-.--,--..,-----,.----,..---,...--,....-,.....,-....,--...,---..,----.,.-.-.-,--..--,..--..,-..-. ,-...-&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrMorse = Split(Morse, &quot;,&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text = UCase(text)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;For i = 1 To Len(text)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;txt2morse = txt2morse &amp; &quot; &quot; &amp; arrMorse(InStr(1, Letters, Mid(text, i, 1)) - 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Next&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;txt2morse = Trim(txt2morse)&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114383817842074707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114383817842074707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114383817842074707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114383817842074707'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/string-2-morse.html' title='String 2 Morse'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114359006956094422</id><published>2006-03-29T01:54:00.000+02:00</published><updated>2006-03-29T02:17:04.036+02:00</updated><title type='text'>Why do I program?</title><content type='html'>I started programming at school for an exam, and I thought all I need was to pass it. That&#39;s was right, but when I started working I couldn&#39;t get enough to be just a small end-user who have to thanks any junior or (pseudo)senior programmer telling me that all can be done, but ... they never did.&lt;BR&gt;&lt;br /&gt;One day my father teach me that:&lt;br /&gt;&quot;If a stupid more stupid than you did it, why can&#39;t you get it?&quot;&lt;BR&gt;&lt;br /&gt;This was for my driving licence, but till now it worked out for almost anything. &lt;br /&gt;Maybe I could write the first &quot;one row&quot; self help book with this phrase. I&#39;ll think about it!&lt;br&gt;&lt;br /&gt;... so I started use Excel and all its functions, but it wasn&#39;t enough, I wanted more, so I re-started learning programming.&lt;BR&gt;&lt;br /&gt;How to learn?&lt;br /&gt;Well I did some macro recording, but the code was not flexible enough so I pick a book with some VBA Examples (&lt;A HREF=&quot;http://www.apogeonline.com/libri/88-7303-736-4/scheda&quot; target=&quot;_blank&quot;&gt;Laboratorio di VBA&lt;/A&gt;)&lt;br /&gt;It was not enough ...&lt;br /&gt;So I got the Walkenbach bible (in French) &lt;A HREF=&quot;http://www.amazon.fr/exec/obidos/ASIN/2746400480/&quot; target=&quot;_blank&quot;&gt;Excel 2000 - programmer avec VBA &lt;/A&gt;&lt;BR&gt;&lt;br /&gt;It was enough! from now on, to get more I had to browse the web and to do my own.&lt;br /&gt;It&#39;s always a matter of equilibrium:&lt;br /&gt;What you should let excel do and when let VBA start play.&lt;br /&gt;How to organise your data and your spreadsheet.&lt;br /&gt;This is just a matter of experience (stratified error)&lt;BR&gt;&lt;br /&gt;Just to better illustrate my point of view I&#39;ve been a little far from VBA to VB with Balena (&lt;A HREF=&quot;http://www.amazon.com/gp/product/0735605580/&quot; target=&quot;_blank&quot;&gt;Programming Microsoft Visual Basic 6.0&lt;/A&gt;)&lt;br /&gt;But after a little bit of hesitation I come back to Excel and VBA because I usually be the end-user of my creation so I need just a flexible tool fast, quick and ... clean.&lt;BR&gt;&lt;br /&gt;If you start build your own forms with VB you get creasy counting pixels to arrange all the objects you put on it, and after all I don&#39;t want to rebuild Excel to manipulate the output/input.&lt;BR&gt;&lt;br /&gt;Know I feel comfortable with VBA, SQL, Javascript, HTML and of course Excel, &lt;br /&gt;and I have to thank all the author of books and web site, &lt;br /&gt;with a special thank to &lt;A HREF=&quot;http://www.joelonsoftware.com/AboutMe.html&quot; target=&quot;_blank&quot;&gt;Joel Spolsky&lt;/A&gt;&lt;br /&gt;... but maybe, most of all I should thank all the people who ask and answer groups!&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;Thank you</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114359006956094422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114359006956094422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114359006956094422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114359006956094422'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/why-do-i-program.html' title='Why do I program?'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114358605082482037</id><published>2006-03-29T00:46:00.000+02:00</published><updated>2006-04-01T03:06:05.983+02:00</updated><title type='text'>When you forgot Password ... you need to break them!</title><content type='html'>It&#39;s easy because the Excel worksheet protection is not very strong.&lt;BR&gt;&lt;br /&gt;For some people this a bug, for me it is ok, because I use protection &lt;br /&gt;just to prevent end-user destruction! ... If You know what I mean.&lt;BR&gt;&lt;br /&gt;So you can put any kind of password and forget it, because with&lt;br /&gt;the code I post now you are no more in trouble.&lt;BR&gt;&lt;br /&gt;personally I like this pwd &quot;sdsadsadsdssdadadasdsadsadasdasdas&quot;&lt;br /&gt;(you can break with &quot;AAAAAABBBBAe&quot;)&lt;BR&gt;&lt;br /&gt;This code is not mine it comes from Aaron T. Blood web page&lt;br /&gt;&lt;A HREF=&quot;http://www.xl-logic.com/pages/vba.html&quot; target=&quot;_blank&quot;&gt;www.xl-logic.com/pages/vba.html&lt;/A&gt;&lt;br /&gt;here the file (the original one):&lt;br /&gt;&lt;A HREF=&quot;http://www.xl-logic.com/xl_files/vba/password_hack.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt; password_hack.xls &lt;/A&gt;&lt;br /&gt;After reading the code don&#39;t tell me that programming is not a kind of magic!&lt;BR&gt;&lt;br /&gt;This is my first occasion to thank all the smart guy out there that likes to share&lt;br /&gt;their knowledge!&lt;br /&gt;Here&#39;s the code (I don&#39;t understand ... but I adapt myself):&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Sub breakit()&lt;br /&gt;Dim i As Integer, j As Integer, k As Integer, &lt;br /&gt;Dim l As Integer, m As Integer, n As Integer&lt;br /&gt;On Error Resume Next&lt;br /&gt;For i = 65 To 66&lt;br /&gt;For j = 65 To 66&lt;br /&gt;For k = 65 To 66&lt;br /&gt;For l = 65 To 66&lt;br /&gt;For m = 65 To 66&lt;br /&gt;For i1 = 65 To 66&lt;br /&gt;For i2 = 65 To 66&lt;br /&gt;For i3 = 65 To 66&lt;br /&gt;For i4 = 65 To 66&lt;br /&gt;For i5 = 65 To 66&lt;br /&gt;For i6 = 65 To 66&lt;br /&gt;For n = 32 To 126&lt;br /&gt;ActiveSheet.Unprotect Chr(i) &amp; Chr(j) &amp; Chr(k) &amp; Chr(l) &amp; Chr(m) &amp; Chr(i1) &amp; _&lt;br /&gt;&amp;nbsp; Chr(i2) &amp; Chr(i3) &amp; Chr(i4) &amp; Chr(i5) &amp; Chr(i6) &amp; Chr(n)&lt;br /&gt;Application.StatusBar = Chr(i) &amp; Chr(j) &amp; Chr(k) &amp; Chr(l) &amp; Chr(m) &amp; Chr(i1) &amp; _&lt;br /&gt;&amp;nbsp; Chr(i2) &amp; Chr(i3) &amp; Chr(i4) &amp; Chr(i5) &amp; Chr(i6) &amp; Chr(n)&lt;br /&gt;If ActiveSheet.ProtectContents = False Then&lt;br /&gt;MsgBox &quot;One useble password is &quot; &amp; Chr(i) &amp; Chr(j) &amp; Chr(k) &amp; Chr(l) &amp; Chr(m) &amp; _&lt;br /&gt;&amp;nbsp; Chr(i1) &amp; Chr(i2) &amp; Chr(i3) &amp; Chr(i4) &amp; Chr(i5) &amp; Chr(i6) &amp; Chr(n)&lt;br /&gt;Exit Sub&lt;br /&gt;End If&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114358605082482037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114358605082482037' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358605082482037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358605082482037'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/when-you-forgot-password-you-need-to.html' title='When you forgot Password ... you need to break them!'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114358339152531046</id><published>2006-03-29T00:02:00.000+02:00</published><updated>2006-03-29T22:52:33.516+02:00</updated><title type='text'>VBA Code Extractor</title><content type='html'>In previous post you selected unique files (ANY) and now you&#39;d like&lt;br /&gt;to search inside all the beautiful VBA code you written or you got there&lt;br /&gt;or elsewhere.&lt;BR&gt;&lt;br /&gt;For this reason I found a elegant solution on the web and&lt;br /&gt;I improved a little (I just put an interface to it)&lt;BR&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/ExportCode.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt; ExportCode.xls &lt;/A&gt;&lt;BR&gt;&lt;br /&gt;Note: to use this particular macro you have to change &lt;br /&gt;an Excel setting (if you don&#39;t you&#39;ll get nothing):&lt;BR&gt;&lt;br /&gt;So just follow the Excels Menus&lt;br /&gt;[Tools][Macro][Security...] to [Trusted Sources]&lt;br /&gt;and activate &quot;Trust access to Visual Basic Project&quot;&lt;BR&gt;&lt;br /&gt;After you run it you get a lot of *.cod files and maybe &lt;br /&gt;you&#39;d like to merge all them to better search inside with &lt;br /&gt;a text editor (I use ultraedit).&lt;BR&gt;&lt;br /&gt;To do this you just need a simple batch file:&lt;br /&gt;copy and paste this one-row code in a file you call &quot;Merge.bat&quot; &lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;copy *.cod Merged.txt&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;... and run it, now you have a big file with all your VBA code to search inside!</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114358339152531046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114358339152531046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358339152531046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358339152531046'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/vba-code-extractor.html' title='VBA Code Extractor'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114358079289504198</id><published>2006-03-28T22:44:00.001+02:00</published><updated>2006-04-01T03:10:12.276+02:00</updated><title type='text'>Comparing files ... when you have too many files</title><content type='html'>In the last post I uploaded a spreadsheet to search all files in your PC&lt;br /&gt;but now you got too many files, and if you are like me (I never throw away a &lt;br /&gt;file and I do some kind of confusing versioning) you can get lost quick to find &lt;br /&gt;latest version.&lt;BR&gt;&lt;br /&gt;I&#39;ve been looking around, but I didn&#39;t find anything that fit my needs, so&lt;br /&gt;as usual I did my own.&lt;BR&gt;&lt;br /&gt;Compare two files and decide if they are identical it&#39;s a kind of art &lt;br /&gt;(without open them). I remarked that 2 identical files can be different&lt;br /&gt;in byte comparing just because one has been closed with cell A1 selected&lt;br /&gt;and another with cell B2 ...&lt;BR&gt;&lt;br /&gt;So comparing them just byte by byte it&#39;s not enough.&lt;br /&gt;For this reason I personally consider identical files with same lenght&lt;br /&gt;and 98% or more bytes identical ...&lt;BR&gt;&lt;br /&gt;I did 2 functions, the first to know if 2 file are 100% identical&lt;br /&gt;and the second to know how much they are similar &lt;BR&gt;&lt;br /&gt;If you don&#39;t like to read code, but you need just a solution&lt;br /&gt;please download it know: &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/File_Move_Rename.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt; File_Move_Rename.xls &lt;/A&gt;&lt;BR&gt;&lt;br /&gt;Remarks that in the spreadsheet there are other functions:&lt;br /&gt;FileMoveFile, FileDeleteFile, FolderCreate, FolderExists, ...&lt;BR&gt;&lt;br /&gt;So first you need a simple code to compare files&lt;br /&gt;Here&#39;s the code (ops ... comments are in Italian):&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Sub testFileBynaryCompare()&lt;br /&gt;Dim BinaryFile1, BinaryFile2, MyStart, MyResult&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    BinaryFile1 = &quot;c:\P4.html&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    BinaryFile2 = &quot;c:\p3.html&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyStart = Now&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyResult = FileBynaryCompare(BinaryFile1, BinaryFile2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MsgBox (Now - MyStart) * 86400 * 1000000000 / FileLen(BinaryFile1) &amp; &quot; sec / giga&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MsgBox MyResult&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;Function FileBynaryCompare(ByVal BinaryFile1 As String, ByVal BinaryFile2 As String) As Boolean&lt;br /&gt;&#39; funzione che verifica se 2 file sono uguali per ogni singolo byte&lt;br /&gt;&#39; verifico che i file esistono&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If (Len(Dir(BinaryFile1)) = 0) Then GoTo ExitFunction&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If (Len(Dir(BinaryFile2)) = 0) Then GoTo ExitFunction&lt;br /&gt;&#39;verifico che abbiano dimensioni uguali&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If FileLen(BinaryFile1) &lt;&gt; FileLen(BinaryFile2) Then GoTo ExitFunction&lt;br /&gt;&lt;br /&gt;&#39; dimensione della stringa estratta&lt;br /&gt;Dim BYTE_SIZE&lt;br /&gt;BYTE_SIZE = 5000&lt;br /&gt;Dim StrVar1 As String * 5000&lt;br /&gt;Dim StrVar2 As String * 5000&lt;br /&gt;Dim FileNum1, FileNum2, i&lt;br /&gt;&#39; Apro il primo file&lt;br /&gt;FileNum1 = FreeFile&lt;br /&gt;Open BinaryFile1 For Binary Access Read As #FileNum1&lt;br /&gt;&#39; Apro il secondo file&lt;br /&gt;FileNum2 = FreeFile&lt;br /&gt;Open BinaryFile2 For Binary Access Read As #FileNum2&lt;br /&gt;&#39;confronto 5000 byte alla volta&lt;br /&gt;i = 1&lt;br /&gt;Do Until EOF(FileNum1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Get #FileNum1, i, StrVar1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Get #FileNum2, i, StrVar2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        If StrVar1 &lt;&gt; StrVar2 Then GoTo ExitFunction&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    i = i + BYTE_SIZE&lt;br /&gt;Loop&lt;br /&gt;&#39; se sono arrivato qui vuol dire che sono uguali&lt;br /&gt;FileBynaryCompare = True&lt;br /&gt;&lt;br /&gt;ExitFunction:&lt;br /&gt;Close #FileNum1&lt;br /&gt;Close #FileNum2&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But, if the too files are similar for 99% you don&#39;t&lt;br /&gt;get the result you expect so with a little modification&lt;br /&gt;you can get a better result&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;Sub testFileSimilitude()&lt;br /&gt;Dim BinaryFile1, BinaryFile2, MyStart, MyResult&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    BinaryFile1 = &quot;c:\P4.html&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    BinaryFile2 = &quot;c:\p3.html&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyStart = Now&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MyResult = FileSimilitude(BinaryFile1, BinaryFile2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MsgBox (Now - MyStart) * 86400 * 1000000000 / FileLen(BinaryFile1) &amp; &quot; sec / giga&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    MsgBox MyResult&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;Function FileSimilitude(ByVal BinaryFile1 As String, ByVal BinaryFile2 As String) As Single&lt;br /&gt;&#39; funzione che verifica se 2 file sono uguali per ogni singolo byte&lt;br /&gt;&#39; verifico che i file esistono&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If (Len(Dir(BinaryFile1)) = 0) Then GoTo ExitFunction&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If (Len(Dir(BinaryFile2)) = 0) Then GoTo ExitFunction&lt;br /&gt;&#39;verifico che abbiano dimensioni uguali&lt;br /&gt;Dim FileLen1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    FileLen1 = FileLen(BinaryFile1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If FileLen1 &lt;&gt; FileLen(BinaryFile2) Then GoTo ExitFunction&lt;br /&gt;&lt;br /&gt;If FileBynaryCompare(BinaryFile1, BinaryFile2) = True Then&lt;br /&gt;FileSimilitude = 1&lt;br /&gt;GoTo ExitFunction&lt;br /&gt;&lt;br /&gt;End If&lt;br /&gt;&#39; dimensione della stringa estratta&lt;br /&gt;Dim BYTE_SIZE&lt;br /&gt;BYTE_SIZE = 5000&lt;br /&gt;Dim StrVar1 As String * 5000&lt;br /&gt;Dim StrVar2 As String * 5000&lt;br /&gt;Dim FileNum1, FileNum2, i, k, j As Single&lt;br /&gt;&#39; Apro il primo file&lt;br /&gt;FileNum1 = FreeFile&lt;br /&gt;Open BinaryFile1 For Binary Access Read As #FileNum1&lt;br /&gt;&#39; Apro il secondo file&lt;br /&gt;FileNum2 = FreeFile&lt;br /&gt;Open BinaryFile2 For Binary Access Read As #FileNum2&lt;br /&gt;&#39;confronto 5000 byte alla volta&lt;br /&gt;i = 1&lt;br /&gt;j = 0&lt;br /&gt;Do Until EOF(FileNum1)&lt;br /&gt;    Get #FileNum1, i, StrVar1&lt;br /&gt;    Get #FileNum2, i, StrVar2&lt;br /&gt;        If StrVar1 &lt;&gt; StrVar2 Then&lt;br /&gt;            For k = 1 To Len(StrVar1)&lt;br /&gt;                If Mid(StrVar1, k, 1) &lt;&gt; Mid(StrVar2, k, 1) Then j = j + 1&lt;br /&gt;                If j &gt; FileLen1 / 20 Then GoTo ExitFunction&lt;br /&gt;            Next&lt;br /&gt;        End If&lt;br /&gt;    i = i + BYTE_SIZE&lt;br /&gt;Loop&lt;br /&gt;&#39; se sono arrivato qui vuol dire che sono uguali&lt;br /&gt;    If FileLen1 = 0 Then&lt;br /&gt;        FileSimilitude = 1&lt;br /&gt;    Else&lt;br /&gt;        FileSimilitude = (FileLen(BinaryFile1) - j) / FileLen(BinaryFile1)&lt;br /&gt;    End If&lt;br /&gt;ExitFunction:&lt;br /&gt;Close #FileNum1&lt;br /&gt;Close #FileNum2&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remark that Function FileSimilitude is a lot slower than FileBynaryCompare</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114358079289504198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114358079289504198' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358079289504198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114358079289504198'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/03/comparing-files-when-you-have-too-many_28.html' title='Comparing files ... when you have too many files'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-114112544308093639</id><published>2006-02-28T12:12:00.000+01:00</published><updated>2006-04-01T03:12:27.476+02:00</updated><title type='text'>Excel List File</title><content type='html'>I have so many file and it&#39;s so hard to find them...&lt;br /&gt;I&#39;d like to search and sort them within Excel. I think it&#39;s easier because Excel manage big list.&lt;br /&gt;&lt;br /&gt;For this reason I did a Excel file. &lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/List_File.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt; List_File.xls &lt;/A&gt; to search, sort any file. It is very easy and fast to use!&lt;BR&gt;&lt;br /&gt;Here&#39;s the code:&lt;BR&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=10 border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;TD class=code&gt;&lt;br /&gt;&#39;32-bit API declarations&lt;br /&gt;Public IndirizzoDirectory As String&lt;br /&gt;Declare Function SHGetPathFromIDList Lib &quot;shell32.dll&quot; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;  Alias &quot;SHGetPathFromIDListA&quot; (ByVal pidl As Long, ByVal pszPath As String) As Long&lt;br /&gt;&lt;br /&gt;Declare Function SHBrowseForFolder Lib &quot;shell32.dll&quot; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;  Alias &quot;SHBrowseForFolderA&quot; (lpBrowseInfo As BROWSEINFO) As Long&lt;br /&gt;  &lt;br /&gt;Public Type BROWSEINFO&lt;br /&gt;&amp;nbsp;&amp;nbsp;  hOwner As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;  pidlRoot As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;  pszDisplayName As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;  lpszTitle As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;  ulFlags As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;  lpfn As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;  lParam As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp;  iImage As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Sub Sub_GetDirectory()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; Just to set some VAR and cal the GetDirectory Function&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim Msg_Directory As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Msg_Directory = Range(&quot;Msg_Directory&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Range(&quot;Directory&quot;) = GetDirectory(Msg_Directory)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Function GetDirectory(Optional Msg) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &#39; open the browser to select a Directory into the PC&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim bInfo As BROWSEINFO&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim path As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Dim r As Long, x As Long, pos As Integer&lt;br /&gt;&lt;br /&gt;&#39; Root folder = Desktop&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    bInfo.pidlRoot = 0&amp;&lt;br /&gt;&lt;br /&gt;&#39; Title in the dialog&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    If IsMissing(Msg) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        bInfo.lpszTitle = &quot;Select a folder.&quot;&lt;br /&gt;    Else&lt;br /&gt;        bInfo.lpszTitle = Msg&lt;br /&gt;  End If&lt;br /&gt;&lt;br /&gt;&#39; Type of directory to return&lt;br /&gt;    bInfo.ulFlags = &amp;H1&lt;br /&gt;&lt;br /&gt;&#39; Display the dialog&lt;br /&gt;    x = SHBrowseForFolder(bInfo)&lt;br /&gt;&lt;br /&gt;&#39; Parse the result&lt;br /&gt;    path = Space$(512)&lt;br /&gt;    r = SHGetPathFromIDList(ByVal x, ByVal path)&lt;br /&gt;    If r Then&lt;br /&gt;        pos = InStr(path, Chr$(0))&lt;br /&gt;        GetDirectory = Left(path, pos - 1)&lt;br /&gt;    Else&lt;br /&gt;        GetDirectory = &quot;&quot;&lt;br /&gt;  End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sub GetListFile()&lt;br /&gt;&#39; Just to set some VAR and call the ListFiles Sub&lt;br /&gt;Dim SubFolder As Boolean, _&lt;br /&gt;    Directory As String, _&lt;br /&gt;    FileType As String&lt;br /&gt;&lt;br /&gt;Directory = Range(&quot;Directory&quot;)&lt;br /&gt;FileType = Range(&quot;FileType&quot;)&lt;br /&gt;SubFolder = Range(&quot;SubFolder&quot;)&lt;br /&gt;&lt;br /&gt;ListFiles Directory, FileType, SubFolder&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sub ListFiles(Optional ByVal IndirizzoDirectory As String = &quot;C:\&quot;, Optional ByVal NomeFile As String = &quot;*.*&quot;, Optional ByVal CercaSottoCartelle As Boolean = False)&lt;br /&gt;&#39;   if the directory is not ending with &quot;\&quot; it add it&lt;br /&gt;    If Right(IndirizzoDirectory, 1) &lt;&gt; &quot;\&quot; Then IndirizzoDirectory = IndirizzoDirectory &amp; &quot;\&quot;&lt;br /&gt;    &lt;br /&gt;    Range(&quot;OutPut&quot;).ClearContents&lt;br /&gt;        &lt;br /&gt;&#39;   Insert headers&lt;br /&gt;    r = 1&lt;br /&gt;    &lt;br /&gt;    Cells(r, 1) = &quot;Name&quot;&lt;br /&gt;    Cells(r, 2) = &quot;Size&quot;&lt;br /&gt;    Cells(r, 3) = &quot;Date/Time&quot;&lt;br /&gt;    Range(&quot;A1:C1&quot;).Font.Bold = True&lt;br /&gt;    r = r + 1&lt;br /&gt;&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    With Application.FileSearch&lt;br /&gt;        .NewSearch&lt;br /&gt;        .LookIn = IndirizzoDirectory&lt;br /&gt;        .Filename = NomeFile&lt;br /&gt;        .SearchSubFolders = CercaSottoCartelle&lt;br /&gt;        .Execute&lt;br /&gt;        For i = 1 To .FoundFiles.Count&lt;br /&gt;            Cells(r, 1) = .FoundFiles(i)&lt;br /&gt;            Cells(r, 2) = FileLen(.FoundFiles(i))&lt;br /&gt;            Cells(r, 3) = FileDateTime(.FoundFiles(i))&lt;br /&gt;            r = r + 1&lt;br /&gt;        Next i&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;A HREF=&quot;http://xoomer.virgilio.it/icebergcode/List_File.zip&quot; ONMOUSEDOWN=&quot;if ((document.layers &amp;&amp; event.which == 3) || (document.all &amp;&amp; event.button != 2)) alert(&#39;Please Right Click!&#39;); return false;&quot;&gt;&lt;b&gt;Download it now &lt;/b&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/114112544308093639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/114112544308093639' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114112544308093639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/114112544308093639'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2006/02/excel-list-file.html' title='Excel List File'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-113469923228039461</id><published>2005-12-16T03:02:00.000+01:00</published><updated>2005-12-16T03:17:19.976+01:00</updated><title type='text'>Excel Sudoku Solver</title><content type='html'>If you like Sudoku and you can&#39;t wait to verify your solution you can use this&lt;br /&gt;&lt;a href=&quot;http://xoomer.virgilio.it/icebergcode/SudokuSolver.zip&quot;&gt;Excel Sudoku Solver&lt;/a&gt;.&lt;br /&gt;It is password protected, but the code inside is very simple, because all the job is done by Excel itself The code just add some &quot;copy and paste&quot;.&lt;br /&gt;&lt;br /&gt;The Interesting aspect of this workbook is the warning that force (ehm ... suggest) the end user to activate macros.&lt;br /&gt;&lt;br /&gt;In next future I will post How to add this warning!&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://xoomer.virgilio.it/icebergcode/SudokuSolver.zip&quot;&gt;&lt;b&gt;Download it now &lt;/b&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/113469923228039461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/113469923228039461' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469923228039461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469923228039461'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2005/12/excel-sudoku-solver.html' title='Excel Sudoku Solver'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-113469571234231825</id><published>2005-12-16T02:14:00.000+01:00</published><updated>2005-12-16T02:15:12.343+01:00</updated><title type='text'>Bird pit Stop</title><content type='html'>&lt;a href=&quot;http://photos1.blogger.com/blogger/5121/1842/320/DSC02054.jpg&quot;&gt;&lt;img style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5121/1842/160/DSC02054.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href=&#39;http://picasa.google.com/&#39; target=&#39;ext&#39;&gt;&lt;img src=&#39;http://photos1.blogger.com/pbp.gif&#39; alt=&#39;Posted by Picasa&#39; style=&#39;border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;&#39; align=&#39;middle&#39; border=&#39;0&#39; /&gt;&lt;/a&gt; </content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/113469571234231825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/113469571234231825' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469571234231825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469571234231825'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2005/12/bird-pit-stop.html' title='Bird pit Stop'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-113469550703135939</id><published>2005-12-16T02:11:00.000+01:00</published><updated>2005-12-16T02:11:47.033+01:00</updated><title type='text'>First snow in Milan</title><content type='html'>&lt;a href=&quot;http://photos1.blogger.com/blogger/5121/1842/320/DSC02246.jpg&quot;&gt;&lt;img style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5121/1842/160/DSC02246.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href=&#39;http://picasa.google.com/&#39; target=&#39;ext&#39;&gt;&lt;img src=&#39;http://photos1.blogger.com/pbp.gif&#39; alt=&#39;Posted by Picasa&#39; style=&#39;border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;&#39; align=&#39;middle&#39; border=&#39;0&#39; /&gt;&lt;/a&gt; </content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/113469550703135939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/113469550703135939' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469550703135939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469550703135939'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2005/12/first-snow-in-milan.html' title='First snow in Milan'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-113469444420186644</id><published>2005-12-16T01:52:00.000+01:00</published><updated>2005-12-16T01:54:04.203+01:00</updated><title type='text'>Where&#39;s my Pants???</title><content type='html'>&lt;a href=&quot;http://photos1.blogger.com/blogger/5121/1842/320/DSC02311.jpg&quot;&gt;&lt;img style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://photos1.blogger.com/blogger/5121/1842/160/DSC02311.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href=&#39;http://picasa.google.com/&#39; target=&#39;ext&#39;&gt;&lt;img src=&#39;http://photos1.blogger.com/pbp.gif&#39; alt=&#39;Posted by Picasa&#39; style=&#39;border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;&#39; align=&#39;middle&#39; border=&#39;0&#39; /&gt;&lt;/a&gt; </content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/113469444420186644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/113469444420186644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469444420186644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113469444420186644'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2005/12/wheres-my-pants.html' title='Where&#39;s my Pants???'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18750876.post-113142840730428806</id><published>2005-11-08T06:22:00.000+01:00</published><updated>2006-03-29T22:07:34.206+02:00</updated><title type='text'>Welcome!</title><content type='html'>&lt;strong&gt;Thank you&lt;/strong&gt; visiting ICB - Iceberg Code Blog&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why a Bloog?&lt;/strong&gt; because it is quick and ... clean :-)&lt;br /&gt;This is the place, where I&#39;d like to share my &lt;strong&gt;ideas&lt;/strong&gt; and some useful code (&lt;strong&gt;VB, Excel, T-SQL, JavaScript&lt;/strong&gt;, ...)&lt;br /&gt;&lt;br /&gt;Some code I&#39;d like to share have been found on the web (I don&#39;t remember where) or I have created by myself, so it can be your code or mine, it doesn&#39;t matter to me.&lt;br /&gt;&lt;br /&gt;The only thing matter is that &lt;strong&gt;the code works&lt;/strong&gt;!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why Iceberg?&lt;/strong&gt;&lt;br /&gt;Because They are made of water, they look pure and they are beautiful.&lt;br /&gt;They born and then &quot;lives&quot; till they slowly fuse and die. They can be dangerous.&lt;br /&gt;This is a good metaphor to coding and technologies in general.&lt;br /&gt;You need to know just 10% of them to understand their size and importance,&lt;br /&gt;the rest are details, and understand all of them takes more time than they are gone.&lt;br /&gt;And after all Nothing is wasted Only reproduced.&lt;br /&gt;&lt;br /&gt;By the way, I&#39;m always looking for the perfect code &lt;em&gt;that does not exist&lt;/em&gt;,&lt;br /&gt;but the optimized one can exist, so&lt;strong&gt; please&lt;/strong&gt; &lt;strong&gt;leave a comment to improve it&lt;/strong&gt;!</content><link rel='replies' type='application/atom+xml' href='http://icebergcode.blogspot.com/feeds/113142840730428806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/18750876/113142840730428806' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113142840730428806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18750876/posts/default/113142840730428806'/><link rel='alternate' type='text/html' href='http://icebergcode.blogspot.com/2005/11/welcome.html' title='Welcome!'/><author><name>Lorenzo</name><uri>http://www.blogger.com/profile/08497268889683417516</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://photos1.blogger.com/blogger/5121/1842/320/Lorenzo1.jpg'/></author><thr:total>1</thr:total></entry></feed>