Checking a cell
That's the opposite,
when something change on the sheet (or in the workbook) you checj , then, if
it's your cell.
for any sheet, you will place your code on the ThisWorbook Excel Object's
code
(and no other module else !)
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
' your code
End Sub
for only one sheet, you can place the code on the shhet's code
(and no other module else)
Private Sub Worksheet_Change(ByVal Target As Range)
' your code
End Sub
IN BOTH CASES, Target is the changed range
The code could, for example be:
if not (Application.Intersect(Target, Range("A1")) Is Nothing) then
'what I want for this cell
end if
' if you try it from workbook (not sheet) think about also testing the
active sheet name !
for example add a
if (activesheet.name = Sheet1.name) and (...) then
end if
or for the range use the: sheet1.range("A1") (and not the range alone)
For more details, take a look on events' helps
(this is classical and quick to be found on internet, when looking for it)
David.
|