ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need code for simple change event (https://www.excelbanter.com/excel-programming/298375-need-code-simple-change-event.html)

Jake[_8_]

Need code for simple change event
 
I want to run a simple If..Then based on a change to a range of cells
containing text. Basically something like this

If Range("E50:E100") changes Then
Range("A3") = Now()
End if

So if the text changes in the range the date of the document updates
to the system date. Seems like it should be simple but I can't figure
out how to do it. Any help appreciated.

Jake

Rob Bovey

Need code for simple change event
 
Hi Jake,

Here's one way to do it:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngTest As Range
On Error Resume Next
Set rngTest = Intersect(Target, Me.Range("E50:E100"))
On Error GoTo 0
If Not rngTest Is Nothing Then
Me.Range("A3").Value = Now()
End If
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Jake" wrote in message
om...
I want to run a simple If..Then based on a change to a range of cells
containing text. Basically something like this

If Range("E50:E100") changes Then
Range("A3") = Now()
End if

So if the text changes in the range the date of the document updates
to the system date. Seems like it should be simple but I can't figure
out how to do it. Any help appreciated.

Jake




Frank Kabel

Need code for simple change event
 
Hi
have a look at
http://www.mcgimpsey.com/excel/timestamp.html

--
Regards
Frank Kabel
Frankfurt, Germany

"Jake" schrieb im Newsbeitrag
om...
I want to run a simple If..Then based on a change to a range of cells
containing text. Basically something like this

If Range("E50:E100") changes Then
Range("A3") = Now()
End if

So if the text changes in the range the date of the document updates
to the system date. Seems like it should be simple but I can't

figure
out how to do it. Any help appreciated.

Jake




All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com