尝试在application.worksheetfunction.match中使用布尔逻辑并获得类型不匹配错误
我的工作表函数在工作表中工作得很好,但是,当我尝试在宏中重现它时,我会收到运行时错误13类型不匹配。工作表中的函数是:
= index(tbqa [Quartion],match(true,index(tbqa [wonse] = tbqa [@answer],0),0),0)))
我正在绘制值的表名为“ TBQA” ”。我试图在宏的一部分中提到的两列是“问题”和“答案”。我有一个用户使用的用户组合,它用作比较参考源,名为“ tbabox”,当我单击一个按钮时,我想在“问题”列中索引值,该值与“答案”列中的答案匹配(这是组合下拉值的源)。
Private Sub ShowMeQues_Click()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("Information")
Set ws2 = Sheets("Resource")
MsgBox Application.WorksheetFunction.Index(ws1.Range("TBQA[Question]"), _
Application.WorksheetFunction.Match("TRUE", _
Application.WorksheetFunction.Index(ws1.Range("TBQA[Answer]") = TBABox.Value, 0), 0))
End Sub
我相信,当我试图获得一个“真”值时,问题正在发生,而ws1.range(“ tbqa [anders]”)= tbabox.value,但我可能是错误的。请帮忙。我觉得这是一个简单的修复程序,我刚刚忽略了,但是我一直在搜索互联网,以找出无用的决议。任何建议欢迎。谢谢你!!! :)
I have a worksheet function that is working perfectly fine in the worksheet, however, when I try to reproduce it in a macro I am receiving a Runtime Error 13 Type Mismatch. The function in the worksheet is:
=INDEX(TBQA[Question],MATCH(TRUE,INDEX(TBQA[Answer]=TBQA[@Answer],0),0))
The table I am drawing the values from is named "TBQA". The two columns I am trying to refer to in part of the macro are "Question" and "Answer". I have a UserForm ComboBox that I am using as the comparison reference source named "TBABox" and when I click a button, I want to index the value in the "Question" column that matches the answer in the "Answer" column (which is the source for the ComboBox dropdown values).
Private Sub ShowMeQues_Click()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("Information")
Set ws2 = Sheets("Resource")
MsgBox Application.WorksheetFunction.Index(ws1.Range("TBQA[Question]"), _
Application.WorksheetFunction.Match("TRUE", _
Application.WorksheetFunction.Index(ws1.Range("TBQA[Answer]") = TBABox.Value, 0), 0))
End Sub
I believe the issue is occurring when I am trying to get a "TRUE" value where the ws1.Range("TBQA[Answer]") = TBABox.Value, but I could be wrong. Please help. I feel like it is a simple fix that I am just overlooking, but I have been searching the internet to find out a resolution to no avail. Any suggestions welcome. THANK YOU!!! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够采取另一条路线来解决这个问题!我的主要目标是绕过VBA设置的255个角色限制,并使用匹配功能设置。请参阅我的其他帖子以获取我提出的决议。感谢您的帮助!!!
https://stackoverflow.com/a/a/72582313/10443879
I was able to resolve this issue by taking another route! My main goal was to bypass the 255 Character limit set by VBA with the MATCH function. Please see my other post for the resolution that I came up with. Thank you for your help!!!
https://stackoverflow.com/a/72582313/10443879