Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在输入一些文本后获取单元格的值。基本上,我突出显示一个单元格,输入文本,按回车键,然后我的代码触发并将输入的值分配给一个变量。
以为这很简单,但我很难过!
您可以使用工作表级别的事件处理程序
Dim v As Variant Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target.Cells(1), Me.Range("A1")) Is Nothing Then v = Target.Cells(1).Value End If End Sub
代码进入工作表模块。