【问题标题】:Inserting Bloomberg Formula into Cell将彭博公式插入单元格
【发布时间】:2018-11-19 20:34:32
【问题描述】:

我希望将第 32 行的公式输入到单元格中,但无法运行或编译我的代码。一定有一个引用错误或我没有注意到的语法。有人可以解释运行此代码的问题吗?

谢谢, 奥利

Sub Ticker_Update()

Dim subSector As String
Dim Ticker As String

Dim bRow As Double
Dim tRow As Double

Dim bRow1 As Double

Application.ScreenUpdating = False

With ThisWorkbook.Worksheets("SectorSort")

Range("C8:AA1000").Clear
subSector = Range("B6").Value

Worksheets("Canadian").Activate
    With ThisWorkbook.Worksheets("Canadian")

        tRow = 4
        bRow = Cells(Rows.Count, "C").End(xlUp).row

        Do While tRow <= bRow

            If Cells(tRow, "C").Value = subSector Then
                Ticker = Cells(tRow, "B").Value

                Worksheets("sectorSort").Activate
                    bRow1 = .Cells(Rows.Count, "C").End(xlUp).row + 1
                    .Cells(bRow1, "C") = Ticker
                    .Cells(bRow1, "D").Formula = "=BDS($C8,"CHAIN_TICKERS","CHAIN_STRIKE_PX_OVRD=ATM","CHAIN_EXP_DT_OVRD",TEXT(D$7,"YYYYMMDD"),"CHAIN_PERIODICITY_OVRD=ALL")"

                Worksheets("Canadian").Activate

                tRow = tRow + 1

            Else
                tRow = tRow + 1
            End If

    Loop

    End With

    Worksheets("SectorSort").Activate

End With


End Sub

【问题讨论】:

    标签: excel vba excel-formula syntax


    【解决方案1】:

    在公式中使用双引号""

    .Cells(bRow1, "D").Formula = "=BDS($C8,""CHAIN_TICKERS"",""CHAIN_STRIKE_PX_OVRD=ATM"",""CHAIN_EXP_DT_OVRD"",TEXT(D$7,""YYYYMMDD""),""CHAIN_PERIODICITY_OVRD=ALL"")"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-14
      • 1970-01-01
      • 1970-01-01
      • 2022-11-22
      • 1970-01-01
      相关资源
      最近更新 更多