ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple change event. Need guidance. (https://www.excelbanter.com/excel-programming/298378-simple-change-event-need-guidance.html)

Jakester

Simple change event. Need guidance.
 
I want to run a simple If..Then based on a change to a range of cell
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 t
the system date. Seems like it should be simple but I can't figure ou
how to do it. Any help appreciated.

Jakeste

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Simple change event. Need guidance.
 
Hi
put the following code in your worksheet module:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
if target.cells.count1 then exit sub
If Intersect(Range("E50:E100"), Target) Is Nothing Then Exit Sub
on error goto errhandler
With Target
If .Value < "" Then
Application.EnableEvents = False
me.Range("A3").value=now
me.Range("A3").numberformat="MM/DD/YYYY hh:mm"
End If
End With

errhandler:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Jakester " schrieb im
Newsbeitrag ...
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.

Jakester


---
Message posted from http://www.ExcelForum.com/



pikus

Simple change event. Need guidance.
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 _
And Target.Row = 50 _
And Target.Row <= 100 Then
Range("A3") = Now()
End If
End Sub

= Piku

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:28 PM.

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