0

我希望将第 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
4

1 回答 1

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"")"
于 2018-11-19T20:46:26.017 回答