Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
May 18, 2022
Solved

Is there a way to have a dynamic textjoin with IF condition lookup from another workbook VBA

I tried to create a vba code for this but was unsuccessful, hopefully i could get some help from here.   Sub join() Dim ws As Worksheet Dim exportWb As Workbook Dim exportWs As Worksheet Set expo...
  • HansVogelaar's avatar
    HansVogelaar
    May 19, 2022

    hrh_dash 

    Sorry

    Sub join()
        Dim ws As Worksheet
        Dim exportWb As Workbook
        Dim exportWs As Worksheet
        Dim exportlastRow As Long
        Set ws = Sheet1
        Set exportWb = Workbooks.Open("C:\Users\desktop\export.xlsx")
        Set exportWs = exportWb.Sheets("Sheet1")
        exportlastRow = exportWs.Cells(exportWs.Rows.Count, "E").End(xlUp).Row
        ThisWorkbook.Activate
        ws.Range("C10") = ws.Evaluate("TEXTJOIN("", "",TRUE,IF([export.XLSX]Sheet1!E2:E" & _
            exportlastRow & "=C15,[export.XLSX]Sheet1!A2:A" & exportlastRow & ",""""))")
    End Sub

Resources