Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 1.52 KB

Excel.Range.Dirty.md

File metadata and controls

59 lines (37 loc) · 1.52 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Range.Dirty method (Excel)
vbaxl10.chm144234
vbaxl10.chm144234
Excel.Range.Dirty
c3f177ef-19b9-07e7-a42f-978874528207
05/10/2019
medium

Range.Dirty method (Excel)

Designates a range to be recalculated when the next recalculation occurs.

Syntax

expression.Dirty

expression A variable that represents a Range object.

Remarks

The Calculate method forces the specified range to be recalculated for cells that Microsoft Excel understands as needing recalculation.

If the application is in manual calculation mode, using the Dirty method instructs Excel to identify the specified cell to be recalculated. If the application is in automatic calculation mode, using the Dirty method instructs Excel to perform a recalculation.

Example

In this example, Excel enters a formula in cell A3, saves the changes, and then recalculates cell A3.

Sub UseDirtyMethod() 
 
 MsgBox "Two values and a formula will be entered." 
 Range("A1").Value = 1 
 Range("A2").Value = 2 
 Range("A3").Formula = "=A1+A2" 
 
 ' Save the changes made to the worksheet. 
 Application.DisplayAlerts = False 
 Application.Save 
 MsgBox "Changes saved." 
 
 ' Force a recalculation of range A3. 
 Application.Range("A3").Dirty 
 MsgBox "Try to close the file without saving and a dialog box will appear." 
 
End Sub

[!includeSupport and feedback]