<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Named Constants</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:06:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Krich</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-42393</link>
		<dc:creator>Krich</dc:creator>
		<pubDate>Wed, 25 Nov 2009 18:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-42393</guid>
		<description>&lt;p&gt;Does anyone know how to code a certain column of data under a certain variable, into another column with another variable heading similar to recoding in SPSS.  I have a column which is all letters (i.e. L, L , L , E, E, E, ) and I want to make a function that says if the letter in this column is L then it is now 1.&lt;/p&gt;
&lt;p&gt;any help would be great&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Does anyone know how to code a certain column of data under a certain variable, into another column with another variable heading similar to recoding in SPSS.  I have a column which is all letters (i.e. L, L , L , E, E, E, ) and I want to make a function that says if the letter in this column is L then it is now 1.</p>
<p>any help would be great</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dutch</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-40502</link>
		<dc:creator>Dutch</dc:creator>
		<pubDate>Thu, 06 Aug 2009 16:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-40502</guid>
		<description>&lt;p&gt;I wanted to add some information about just the 2015 Error in junction with Application.Evaluate().&lt;/p&gt;
&lt;p&gt;I have a similar error when trying to parse a custom function. This function receives a string parameter and uses it to retrieve, from within a sheet, another string (double quotes not consistent):&lt;/p&gt;
&lt;p&gt;   ? Application.Evaluate(&quot;GetExplanationForQuery(&quot;My Query&quot;)&quot;)&lt;/p&gt;
&lt;p&gt;After a lot of testing I have come to the conclusion that the Evaluate() fails with Error 2015 if the length of the returned string is above a determined size, which I estimate being 255 characters (the limit of an Byte data type).&lt;/p&gt;
&lt;p&gt;In fact, each time the function returns a long string, I get Error 2015.&lt;/p&gt;
&lt;p&gt;I have also tried using the &quot;[...]&quot; syntax instead of &quot;Application.Evaluate()&quot; without success:&lt;/p&gt;
&lt;p&gt;   ? [GetExplanationForQuery(&quot;My Query&quot;)]&lt;/p&gt;
&lt;p&gt;As a workaround, I now test for &quot;VBA.VarType(vResult) = vbError&quot; and take the entire cell value if true:&lt;/p&gt;
&lt;p&gt;   vResult = Application.Evaluate(sFormulaString)&lt;br&gt;
   If (VBA.VarType(vResult) = vbError) Then vResult = rCell.Value&lt;br&gt;
   rCell.Value = vResult&lt;/p&gt;
&lt;p&gt;Continuing to work on it.&lt;/p&gt;
&lt;p&gt;Dutch&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I wanted to add some information about just the 2015 Error in junction with Application.Evaluate().</p>
<p>I have a similar error when trying to parse a custom function. This function receives a string parameter and uses it to retrieve, from within a sheet, another string (double quotes not consistent):</p>
<p>   ? Application.Evaluate(&#8220;GetExplanationForQuery(&#8220;My Query&#8221;)&#8221;)</p>
<p>After a lot of testing I have come to the conclusion that the Evaluate() fails with Error 2015 if the length of the returned string is above a determined size, which I estimate being 255 characters (the limit of an Byte data type).</p>
<p>In fact, each time the function returns a long string, I get Error 2015.</p>
<p>I have also tried using the &#8220;[...]&#8221; syntax instead of &#8220;Application.Evaluate()&#8221; without success:</p>
<p>   ? [GetExplanationForQuery("My Query")]</p>
<p>As a workaround, I now test for &#8220;VBA.VarType(vResult) = vbError&#8221; and take the entire cell value if true:</p>
<p>   vResult = Application.Evaluate(sFormulaString)<br />
   If (VBA.VarType(vResult) = vbError) Then vResult = rCell.Value<br />
   rCell.Value = vResult</p>
<p>Continuing to work on it.</p>
<p>Dutch</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-32753</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 09 Jun 2008 13:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-32753</guid>
		<description>&lt;p&gt;After convertig the cell to a numeric format, you still may need to convert the contents of that cell to a number.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>After convertig the cell to a numeric format, you still may need to convert the contents of that cell to a number.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob van Gelder</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-32752</link>
		<dc:creator>Rob van Gelder</dc:creator>
		<pubDate>Mon, 09 Jun 2008 12:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-32752</guid>
		<description>&lt;p&gt;Paul&lt;br&gt;
It could be that your cell is formatted as Text.&lt;br&gt;
Right-click the cell, choose Format Cells, then from the Number tab, set the format to General.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Paul<br />
It could be that your cell is formatted as Text.<br />
Right-click the cell, choose Format Cells, then from the Number tab, set the format to General.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-32723</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sat, 07 Jun 2008 00:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-32723</guid>
		<description>&lt;p&gt;I have a constant array, at least a group of 3 columns, with constants in each cell that I want to use for lookup.  I created a name, ObsInstances, for the array to include the range.  I have a cell used for the lookup value, H3, and a cell with the formula &quot;=VLOOKUP($H3,ObsInstances,2,FALSE)&quot;.  The formula didn&#039;t produce anything, the cell always shows the formula.  When I copied the cell to other cells the relative reference did not increment, second clue of trouble.  I copied the spreadsheat to &quot;play&quot; because one is a model with no data.  So in the copy I entered data and it still showed the formula instead of the search result but when I used Tool/Evaluate Formula it showed the formula correctly but said, &quot;The cell currently being evaluated contains a constant&quot;.  I played around deleting blanks and such and the highlighting started to work then the formula worked.  Trouble is I can&#039;t figure out whats wrong because the formula does look any different but now works and I can&#039;t get repeat the miracle in the model spreadsheet.  Anybody have any ideas about what I can do here?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have a constant array, at least a group of 3 columns, with constants in each cell that I want to use for lookup.  I created a name, ObsInstances, for the array to include the range.  I have a cell used for the lookup value, H3, and a cell with the formula &#8220;=VLOOKUP($H3,ObsInstances,2,FALSE)&#8221;.  The formula didn&#8217;t produce anything, the cell always shows the formula.  When I copied the cell to other cells the relative reference did not increment, second clue of trouble.  I copied the spreadsheat to &#8220;play&#8221; because one is a model with no data.  So in the copy I entered data and it still showed the formula instead of the search result but when I used Tool/Evaluate Formula it showed the formula correctly but said, &#8220;The cell currently being evaluated contains a constant&#8221;.  I played around deleting blanks and such and the highlighting started to work then the formula worked.  Trouble is I can&#8217;t figure out whats wrong because the formula does look any different but now works and I can&#8217;t get repeat the miracle in the model spreadsheet.  Anybody have any ideas about what I can do here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Camac</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-28816</link>
		<dc:creator>Ivan Camac</dc:creator>
		<pubDate>Tue, 20 Nov 2007 03:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-28816</guid>
		<description>&lt;p&gt;Looking at the help topic for &#039;Evaluate&#039;, you can also simply put the name of the constant / range in square brackets to use the value. Dick&#039;s example would therefore become:&lt;/p&gt;
&lt;p&gt;Sub test()&lt;/p&gt;
&lt;p&gt;    Sheet1.Range(&quot;A1?).Value = 1&lt;/p&gt;
&lt;p&gt;    ThisWorkbook.Names.Add &quot;Nm1?, Sheet1.Range(&quot;A1?)&lt;br&gt;
    ThisWorkbook.Names.Add &quot;Nm2?, 1&lt;br&gt;
    ThisWorkbook.Names.Add &quot;Nm3?, &quot;String1?&lt;/p&gt;
&lt;p&gt;    Debug.Print [Nm1]&lt;br&gt;
    Debug.Print [Nm2]&lt;br&gt;
    Debug.Print [Nm3]&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Looking at the help topic for &#8216;Evaluate&#8217;, you can also simply put the name of the constant / range in square brackets to use the value. Dick&#8217;s example would therefore become:</p>
<p>Sub test()</p>
<p>    Sheet1.Range(&#8220;A1?).Value = 1</p>
<p>    ThisWorkbook.Names.Add &#8220;Nm1?, Sheet1.Range(&#8220;A1?)<br />
    ThisWorkbook.Names.Add &#8220;Nm2?, 1<br />
    ThisWorkbook.Names.Add &#8220;Nm3?, &#8220;String1?</p>
<p>    Debug.Print [Nm1]<br />
    Debug.Print [Nm2]<br />
    Debug.Print [Nm3]</p>
<p>End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Gruber</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-21763</link>
		<dc:creator>George Gruber</dc:creator>
		<pubDate>Fri, 08 Dec 2006 13:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-21763</guid>
		<description>&lt;p&gt;I just spent about half an hour pulling out my hair.  I used Evaluate to return the result of a constant (Insert -&gt; Name -&gt; Define).  I was trying to determine what the result would be if the name didn&#039;t exist.  If you do not have a On Error Goto within the function of the Evaluate, it hangs up something (probably VBA).  I would have to close the spread sheet and open it again.  I am guessing that there is an issue with the error message processing in VBA or Excel when the Evaluate failed.&lt;/p&gt;
&lt;p&gt;This is Excel 2003.&lt;/p&gt;
&lt;p&gt;I picked your page because of the reference of using named constants.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I just spent about half an hour pulling out my hair.  I used Evaluate to return the result of a constant (Insert -&gt; Name -&gt; Define).  I was trying to determine what the result would be if the name didn&#8217;t exist.  If you do not have a On Error Goto within the function of the Evaluate, it hangs up something (probably VBA).  I would have to close the spread sheet and open it again.  I am guessing that there is an issue with the error message processing in VBA or Excel when the Evaluate failed.</p>
<p>This is Excel 2003.</p>
<p>I picked your page because of the reference of using named constants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Collins</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-1724</link>
		<dc:creator>Jamie Collins</dc:creator>
		<pubDate>Mon, 14 Jun 2004 11:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-1724</guid>
		<description>&lt;p&gt;&quot;If you Evaluate the Value property of the Name object, no error.&quot;&lt;/p&gt;
&lt;p&gt;I think I have my answer! Thanks, Dick. &lt;/p&gt;
&lt;p&gt;Jamie.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;If you Evaluate the Value property of the Name object, no error.&#8221;</p>
<p>I think I have my answer! Thanks, Dick. </p>
<p>Jamie.</p>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan Pablo</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-1723</link>
		<dc:creator>Juan Pablo</dc:creator>
		<pubDate>Fri, 11 Jun 2004 23:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-1723</guid>
		<description>&lt;p&gt;Evaluate(&quot;Nm&quot; &amp; i)&lt;/p&gt;
&lt;p&gt;works too...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Evaluate(&#8220;Nm&#8221; &amp; i)</p>
<p>works too&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/10/named-constants/#comment-1722</link>
		<dc:creator>Dick</dc:creator>
		<pubDate>Fri, 11 Jun 2004 18:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=620#comment-1722</guid>
		<description>&lt;p&gt;&quot;why Application.Evaluate didn&#039;t work out...&quot;&lt;/p&gt;
&lt;p&gt;Just messing around with it a little.  I get the same error.  If you Evaluate the Value property of the Name object, no error.  Evaluate always seems to return Double for numerics, which doesn&#039;t really surprise me.  Try this code&lt;/p&gt;
&lt;p&gt;Sub test()&lt;/p&gt;
&lt;p&gt;Dim i As Long&lt;/p&gt;
&lt;p&gt;Sheet1.Range(&quot;A1?).Value = 1&lt;/p&gt;
&lt;p&gt;ThisWorkbook.Names.Add &quot;Nm1?, Sheet1.Range(&quot;A1?)&lt;br&gt;ThisWorkbook.Names.Add &quot;Nm2?, 1&lt;br&gt;ThisWorkbook.Names.Add &quot;Nm3?, &quot;String1?&lt;/p&gt;
&lt;p&gt;For i = 1 To 3&lt;br&gt;&#160;&#160;&#160;&#160;With Application&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Debug.Print Names(&quot;Nm&quot; &amp; i).Name, _&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.Evaluate(Names(&quot;Nm&quot; &amp; i).Value), _&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;.Evaluate(Names(&quot;Nm&quot; &amp; i)), _&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;TypeName(.Evaluate(Names(&quot;Nm&quot; &amp; i).Value))&lt;br&gt;&#160;&#160;&#160;&#160;End With&lt;br&gt;Next i&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;why Application.Evaluate didn&#8217;t work out&#8230;&#8221;</p>
<p>Just messing around with it a little.  I get the same error.  If you Evaluate the Value property of the Name object, no error.  Evaluate always seems to return Double for numerics, which doesn&#8217;t really surprise me.  Try this code</p>
<p>Sub test()</p>
<p>Dim i As Long</p>
<p>Sheet1.Range(&#8220;A1?).Value = 1</p>
<p>ThisWorkbook.Names.Add &#8220;Nm1?, Sheet1.Range(&#8220;A1?)<br />ThisWorkbook.Names.Add &#8220;Nm2?, 1<br />ThisWorkbook.Names.Add &#8220;Nm3?, &#8220;String1?</p>
<p>For i = 1 To 3<br />&nbsp;&nbsp;&nbsp;&nbsp;With Application<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Debug.Print Names(&#8220;Nm&#8221; &amp; i).Name, _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Evaluate(Names(&#8220;Nm&#8221; &amp; i).Value), _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Evaluate(Names(&#8220;Nm&#8221; &amp; i)), _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TypeName(.Evaluate(Names(&#8220;Nm&#8221; &amp; i).Value))<br />&nbsp;&nbsp;&nbsp;&nbsp;End With<br />Next i</p>
<p>End Sub</p>
]]></content:encoded>
	</item>
</channel>
</rss>

