如何在 VBA 的用户窗体中引用文本框的值?

问题描述 投票:0回答:1

我正在运行一个 xlookup 函数,我以前只在标准单元格上工作过,但现在我正试图让它在我的用户表单中工作。

这是我的代码:

Sub bizlookup()
Worksheets("Input").Range("company").Select
ActiveCell = Application.XLookup(Worksheets("Input").Range("phone"), Worksheets("MASTER").Range("S:S"), Worksheets("MASTER").Range("U:U"))
End Sub

我想用用户窗体上文本框的值替换“(Worksheets(“Input”).Range(“phone”)”。我将如何引用文本框中的值?

excel vba reference userform xlookup
1个回答
0
投票

将其替换为您的用户表单和文本框的名称。

Worksheets("Input").Range("Phone").Value = UserFormName.TextBoxName.Value
© www.soinside.com 2019 - 2024. All rights reserved.