I have this function that tries to determine when a particular cell value changes. The problem is that if the user selects the entire spreadsheet and press delete, I get an overflow in my check that the range is only one cell:
Public Sub Worksheet_Change(ByVal Target As Range) 'Overflow can occur here if range = whole spreadsheet If Not IsError(Int(Target.Cells.Count)) Then If Target.Cells.Count = 1 Then If Target.Cells.Row = 4 And Target.Cells.Column = 1 Then Sheets("X").Cells(5, 1).Calculate End If End If End If End Sub
Is there a more elegant way that I can get this code to work only when changing one specific cell value? (without overflow, problems when cleaning the entire sheet, etc.)?
vba excel-vba excel excel-2007
mezamorphic Jul 27 '12 at 15:07 2012-07-27 15:07
source share