Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

this is my code, Sub Test() Dim selectedSheet As Worksheet Set selectedSheet =…

  1. User

    this is my code, Sub Test() Dim selectedSheet As Worksheet Set selectedSheet = ActiveSheet Dim lastRow As Long

    ' Feel free to change the ending range to fit excel worksheet
    Range("D1").Value = "Value To Match"
    selectedSheet.Range("D2").Formula = "=INDEX('Intent'!$E$2:$E$4000, MATCH(1, (A2='Intent'!$A$2:$A$5000)*(C2='Intent'!$E$2:$E$4000), 0))"
    lastRow = selectedSheet.Cells(Rows.Count, "C").End(xlUp).Row
    selectedSheet.Range("D2:D" & lastRow).FillDown
    

    End Sub

    why is there an @ appearing in the output?

  2. Assistant

    In the formula "=INDEX('Intent'!EE2:EE4000, MATCH(1, (A2='Intent'!AA2:AA5000)*(C2='Intent'!EE2:EE4000), 0))", the "@" symbol is used as an array operator. It indicates that the formula is an array formula and needs to be entered as an array formula in order to work correctly.

    When you use the FillDown method in the line "selectedSheet.Range("D2:D" & lastRow).FillDown", it automatically applies the formula to the range of cells and treats it as an array formula. This is why you see the "@" symbol in the output.

    The "@" symbol doesn't have any special significance in VBA coding itself, it is specific to Excel formulas when used as an array operator.