Excel VBA活动 [英] Excel VBA Events
问题描述
然而,当需要在特定行中更改列X的值时,我还需要更新列Y的值。另外,如果添加了一个行,我也需要提供一个Y值。然而,我似乎找不到相同的适当的事件,禁止在工作表级别的选择更改的事件,当您更改所选的单元格时触发。
尝试工作表更改事件...为了确保列X中发生的某些事情,您可以这样写一些这样的信息:
Private Sub Worksheet_Change(ByVal Target As Range)
如果不相交(目标,范围(X:X))没有,然后
MsgBox(嗨 )
如果
End Sub
希望这有助于
I'm a little new to Excel VBA. I've currently designed VBA code to produce a Vlookup that populates data in a column(say column Y) in my datasheet based on ref data in another sheet, and a filled value in another column (column X) of the same sheet. This I'm performing on the Workbook_Open event.
I need to, however, also be able to update column Y's value when column X's value is changed in a particular row. Also, if an additional row is added, I need to be able to provide a Y value for that too. However, I can't seem to find an appropriate event for the same, barring the selection changed event at Worksheet level, which is triggered when u change which cell you've selected.
Try the worksheet change event... To ensure something happened in Column X, you would write somethign like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("X:X")) Is Nothing Then
MsgBox ("Hi")
End If
End Sub
Hope this helps
这篇关于Excel VBA活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!