is it possible to recalculate only a cell or a range in VBA

前端 未结 2 1125
甜味超标
甜味超标 2020-12-17 10:59

is it possible to recalculate only a cell or a range in VBA ? What I like to use for a sheet is the following, but how to do it on a cell only ? Or range ?

\         


        
相关标签:
2条回答
  • 2020-12-17 11:26

    There is a calculate method you can call on ranges:

    Range("A1").Calculate
    

    Try it out by putting =Now() in A1 and running Calculate and watch it update the seconds :) You can for a recalc of all the cells in a sheet by using:

    Sheets(1).Calculate
    

    See also: Microsoft MSDN, Excel Recalculation, 16 July 2012.

    0 讨论(0)
  • 2020-12-17 11:34

    Calculate: All open workbooks

    Application.Calculate
    

    Calculate: A specific worksheet

    Worksheets(1).Calculate
    

    or

    Worksheets("sheetname").Calculate
    

    Calculate: A specified row

    Worksheets(1).Rows(2).Calculate
    

    or

    Worksheets("sheetname").Range("A1").EntireRow.Calculate
    

    Recalculate in Excel

    Select the cells you would like to recalculate and press:

    Press F9
    
    0 讨论(0)
提交回复
热议问题