How to refresh/load RTD Bloomberg function (BDH) in excel in vba

前端 未结 4 1018
梦如初夏
梦如初夏 2020-12-09 06:25

I would like to know if there\'s a way in VBA code forcing the bloomberg functions (In spreadsheet) to update its value( Any BDH functions)

Targeting Develo

4条回答
  •  春和景丽
    2020-12-09 07:23

    I've found that changing something in the BDH formula would cause a refresh. Find and replace the = sign would do the tick.

    Public Sub Recalc()
        Dim ws As Worksheet, FormulaCells As Range, c As Range
        Application.Calculation = xlCalculationManual
        For Each ws In ThisWorkbook.Worksheets
            On Error Resume Next
            ws.Activate
            Set FormulaCells = ws.UsedRange.SpecialCells(xlCellTypeFormulas).Cells
            If Err = 0 Then
                For Each c In FormulaCells
                    c.Formula = Replace(c.Formula, "=", "=")
                Next 'c
            Else
                Err.Clear
            End If
        Next 'ws
        Application.Calculation = xlCalculationAutomatic
    End Sub
    

提交回复
热议问题