动态文本Join与另一个工作簿中的条件查找VBA查找
如何使用VBA代码进行动态文本Join,并从另一个工作簿中查找条件?
我想将此公式转换为vba:
= textjoin(“,”,true,if($ c $ 15 = [export.xlsx] sheet1!$ e $ 2:$ e $ 13047,[export.xlsx] sheet1! $ 2:$ a $ 13047,“”))
当前这是我到目前为止所做的VBA代码,并且正在弹出错误,说明“运行时错误'91':对象变量或block变量未设置”
Sub join()
Dim exportWb As Workbook
Dim exportWs As Worksheet
Set exportWs = exportWb.Sheets("Sheet1")
Workbooks.Open ("C:\Users\desktop\export.xlsx")
Set exportWb = ActiveWorkbook
ThisWorkbook.Activate
Dim exportlastRow1 As Range
Dim exportlastRow2 As Range
exportlastRow1 = exportWs.Cells(exportWs.Rows.Count, "A").End(xlUp).Row
exportlastRow2 = exportWs.Cells(exportWs.Rows.Count, "E").End(xlUp).Row
Dim existSAPID As String
existSAPID = ActiveSheet.Evaluate("TEXTJOIN(", ",TRUE,IF(C15 =
exportlastRow2,exportlastRow1,""))")
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VBA代码的公式
Formula to VBA Code