Difference between revisions of "Microsoft KB Archive/106463"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 80: Line 80:
 
<li><p>In the Visual Basic module, type the following text:</p>
 
<li><p>In the Visual Basic module, type the following text:</p>
 
<pre class="codesample">    Sub Protect_Sheet1()
 
<pre class="codesample">    Sub Protect_Sheet1()
         ActiveWorkbook.Sheets(&quot;Sheet1&quot;).Protect
+
         ActiveWorkbook.Sheets("Sheet1").Protect
 
     End Sub
 
     End Sub
 
                         </pre></li>
 
                         </pre></li>
Line 88: Line 88:
 
<br />
 
<br />
  
<pre class="fixed_text">  ActiveWorkbook.Sheets(&quot;Sheet1&quot;).Unprotect
+
<pre class="fixed_text">  ActiveWorkbook.Sheets("Sheet1").Unprotect
   ActiveWorkbook.Sheets(&quot;Sheet1&quot;).Visible = True
+
   ActiveWorkbook.Sheets("Sheet1").Visible = True
 
                 </pre>
 
                 </pre>
 
<br />
 
<br />
Line 96: Line 96:
 
<br />
 
<br />
  
<pre class="fixed_text">  ActiveWorkbook.Sheets(&quot;Sheet1&quot;).Move
+
<pre class="fixed_text">  ActiveWorkbook.Sheets("Sheet1").Move
 
                 </pre>
 
                 </pre>
  

Latest revision as of 10:19, 20 July 2020

Article ID: 106463

Article Last Modified on 8/15/2005



APPLIES TO

  • Microsoft Excel 95 Standard Edition
  • Microsoft Excel 5.0c



This article was previously published under Q106463

This article also applies to:

  • Microsoft Excel for Windows 5.0|5.0


SUMMARY

When you apply methods or change properties of a worksheet, the target worksheet may need to be activated before the macro can perform the requested action. If the worksheet is not already active, a brief flash will be noticeable on the screen when the sheet is activated.

WORKAROUND

To resolve the problem explained in this article, add the following line to the beginning of your Visual Basic for Applications macro:

   Application.ScreenUpdating = False
                

MORE INFORMATION

Some methods and properties that are applied to worksheets will cause the worksheet to be briefly activated.

Steps to Reproduce Behavior

  1. From the File menu, choose New, and then choose Workbook.
  2. From the Insert menu, choose Macro, and then choose Module.
  3. In the Visual Basic module, type the following text:

         Sub Protect_Sheet1()
            ActiveWorkbook.Sheets("Sheet1").Protect
         End Sub
                            
  4. With the Visual Basic module active, choose Macro from the Tools menu. Select Protect_Sheet1 from the list and choose Run.

The following procedures will also briefly activate the worksheet:

   ActiveWorkbook.Sheets("Sheet1").Unprotect
   ActiveWorkbook.Sheets("Sheet1").Visible = True
                



Some methods or properties, such as the one in the following example, may activate the sheet and cause it to remain the active sheet:

   ActiveWorkbook.Sheets("Sheet1").Move
                


Additional query words: 5.00c XL

Keywords: KB106463