Getting Excel to refresh data on sheet from within VBA

前端 未结 6 1096
夕颜
夕颜 2020-11-27 06:14

How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?

6条回答
  •  生来不讨喜
    2020-11-27 06:42

    I had an issue with turning off a background image (a DRAFT watermark) in VBA. My change wasn't showing up (which was performed with the Sheets(1).PageSetup.CenterHeader = "" method) - so I needed a way to refresh. The ActiveSheet.EnableCalculation approach partly did the trick, but didn't cover unused cells.

    In the end I found what I needed with a one liner that made the image vanish when it was no longer set :-

    Application.ScreenUpdating = True

提交回复
热议问题