Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
bruneta99 la Simpatie.ro
Femeie
25 ani
Satu Mare
cauta Barbat
25 - 50 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] On Worksheet Change, Insert Date into Cell [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
The following code is pun the the Worksheet code and upon any change in range A1:L300 it will insert the current date (today) in cell F1.


Public Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim keyCells As Range
Set keyCells = Range("A1:L300")

If Not Application.Intersect(keyCells, Range(Target.Address)) Is Nothing Then
    Worksheets("Sheet1").Range("F1").Value = Date
End If

Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub


Without using Application.ScreenUpdating and Application.EnableEvents the code would give error 2147417848 upon running, and Excel would freeze completely afterwards.

Sources:


pus acum 3 ani
   
Pagini: 1  

Mergi la