Check a range is not the entire sheet?

前端 未结 2 2010
没有蜡笔的小新
没有蜡笔的小新 2020-12-22 01:47

I have this function which is trying to detect when a particular cell value changes. The problem is, if the user selects the whole spreadsheet and presses delete, I get an o

2条回答
  •  天命终不由人
    2020-12-22 02:18

    I'm assuming you are on Excel 2007+ since the number of rows and columns increased dramatically in those versions. You might have better luck checking to make sure both the row and column count = 1, since those maxes will be much lower than the product of the two (ie, the cell count):

    If Target.Rows.Count = 1 And Target.Columns.Count = 1 Then
    

提交回复
热议问题