https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/175293&feed=atom&action=history
Microsoft KB Archive/175293 - Revision history
2024-03-28T12:48:17Z
Revision history for this page on the wiki
MediaWiki 1.39.3
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/175293&diff=344935&oldid=prev
X010: Text replacement - """ to """
2020-07-21T10:07:40Z
<p>Text replacement - """ to """</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en-GB">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:07, 21 July 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l64">Line 64:</td>
<td colspan="2" class="diff-lineno">Line 64:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This problem occurs when you reference the Names property in the Change event procedure as in the following example:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This problem occurs when you reference the Names property in the Change event procedure as in the following example:</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Names.Item(<del style="font-weight: bold; text-decoration: none;">&quot;</del>Test<del style="font-weight: bold; text-decoration: none;">&quot;</del>).RefersTo = <del style="font-weight: bold; text-decoration: none;">&quot;</del>=$a$1<del style="font-weight: bold; text-decoration: none;">&quot;</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Names.Item(<ins style="font-weight: bold; text-decoration: none;">"</ins>Test<ins style="font-weight: bold; text-decoration: none;">"</ins>).RefersTo = <ins style="font-weight: bold; text-decoration: none;">"</ins>=$a$1<ins style="font-weight: bold; text-decoration: none;">"</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> End Sub</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> End Sub</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </pre></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l93">Line 93:</td>
<td colspan="2" class="diff-lineno">Line 93:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> ActiveWorkbook.Names.Item(<del style="font-weight: bold; text-decoration: none;">&quot;</del>Test<del style="font-weight: bold; text-decoration: none;">&quot;</del>).RefersTo = <del style="font-weight: bold; text-decoration: none;">&quot;</del>=$a$1<del style="font-weight: bold; text-decoration: none;">&quot;</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> ActiveWorkbook.Names.Item(<ins style="font-weight: bold; text-decoration: none;">"</ins>Test<ins style="font-weight: bold; text-decoration: none;">"</ins>).RefersTo = <ins style="font-weight: bold; text-decoration: none;">"</ins>=$a$1<ins style="font-weight: bold; text-decoration: none;">"</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> End Sub</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> End Sub</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </pre></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l102">Line 102:</td>
<td colspan="2" class="diff-lineno">Line 102:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== REFERENCES ==</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== REFERENCES ==</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>For more information about the Names collection, click the Office Assistant while in the Microsoft Visual Basic Editor, type <span class="kbd userinput"> Names Collection</span>, click Search, and then click to view <del style="font-weight: bold; text-decoration: none;">&quot;</del>Names Collection Object.<del style="font-weight: bold; text-decoration: none;">&quot;</del><br /></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>For more information about the Names collection, click the Office Assistant while in the Microsoft Visual Basic Editor, type <span class="kbd userinput"> Names Collection</span>, click Search, and then click to view <ins style="font-weight: bold; text-decoration: none;">"</ins>Names Collection Object.<ins style="font-weight: bold; text-decoration: none;">"</ins><br /></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><br /></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><br /></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:</div></td></tr>
</table>
X010
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/175293&diff=93792&oldid=prev
3155ffGd: importing KB archive
2020-07-18T15:38:26Z
<p>importing KB archive</p>
<p><b>New page</b></p><div><div id="nsbanner"><br />
<br />
<div id="bannerrow1"><br />
<br />
{|<br />
| Knowledge Base<br />
|<br />
|}<br />
<br />
<br />
</div><br />
<div id="TitleRow"><br />
<br />
= <span id="KB175293"></span>XL97: Worksheet Change Event Error Using Names Property =<br />
<br />
<br />
</div><br />
<br />
</div><br />
<div id="nstext" valign="BOTTOM"><br />
<br />
Article ID: 175293<br />
<br />
Article Last Modified on 11/23/2006<br />
<br />
<br />
-----<br />
<br />
APPLIES TO<br /><br />
<br /><br />
<br />
* Microsoft Excel 97 Standard Edition<br />
<br />
<br />
-----<br />
<br />
<div class="notice_section"><br />
<br />
This article was previously published under Q175293<br />
<br />
</div><br />
<div class="notice_section"><br />
<br />
<br />
<br />
</div><br />
<div class="symptoms_section"><br />
<br />
== SYMPTOMS ==<br />
<br />
When the Change event of a worksheet is triggered, you receive the following error message:<br />
<div class="errormessage"><br />
<br />
Run-time error '1004':<br /><br />
Application-defined or object-defined error<br />
<br />
</div><br />
<br />
</div><br />
<div class="cause_section"><br />
<br />
== CAUSE ==<br />
<br />
This problem occurs when you reference the Names property in the Change event procedure as in the following example:<br />
<pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)<br />
Names.Item(&quot;Test&quot;).RefersTo = &quot;=$a$1&quot;<br />
End Sub<br />
</pre><br />
<br />
</div><br />
<div class="resolution_section"><br />
<br />
== RESOLUTION ==<br />
<br />
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:<br />
<div class="indent"><br />
<br />
https://partner.microsoft.com/global/30000104<br />
<br />
<br />
</div><br />
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:<br />
<div class="indent"><br />
<br />
[http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS]<br />
<br />
<br />
</div><br />
The Names property returns the Names collection, which is a collection of all the Name objects in the application or workbook. When you use the Names property within a worksheet-level event procedure and do not precede it with the workbook that it refers to, a run-time error occurs. To eliminate this error, include the workbook object or the ActiveWorkbook object before the Names property.<br /><br />
<br /><br />
The following sample code demonstrates accessing the Names collection of the active workbook:<br /><br />
<br /><br />
<br />
<pre class="codesample"> Private Sub Worksheet_Change(ByVal Target as Excel.Range)<br />
ActiveWorkbook.Names.Item(&quot;Test&quot;).RefersTo = &quot;=$a$1&quot;<br />
End Sub<br />
</pre><br />
<br />
</div><br />
<div class="references_section"><br />
<br />
== REFERENCES ==<br />
<br />
For more information about the Names collection, click the Office Assistant while in the Microsoft Visual Basic Editor, type <span class="kbd userinput"> Names Collection</span>, click Search, and then click to view &quot;Names Collection Object.&quot;<br /><br />
<br /><br />
NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:<br />
<div class="indent"><br />
<br />
[[../176476|176476]] OFF: Office Assistant Not Answering Visual Basic Questions<br />
<br />
<br />
</div><br />
For additional information about getting help with Microsoft Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:<br />
<div class="indent"><br />
<br />
[[../163435|163435]] VBA: Programming Resources for Visual Basic for Applications<br />
<br />
<br />
</div><br />
<br />
</div><br />
<br /><br />
<br />
Additional query words: XL97 fire vbe<br />
<br />
Keywords: kbdtacode kberrmsg kbprb kbprogramming KB175293<br />
<br />
<div class="footer"><br />
<br />
<br /><br />
<br />
<br />
-----<br />
<br />
[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]<br />
<br />
<span>© Microsoft Corporation. All rights reserved.</span><br />
<br />
<br />
</div><br />
<br />
</div></div>
3155ffGd