Ciao Eduardo.
> Grazie Norman,> funziona benissimo. Ti chiedo un'ulteriore cortesia
> per non dovermi
> creare un sacco di fogli. Se volessi usare la stessa formula in più
> colonne di una stesso foglio? Mi spiego meglio:
>
> A B C D
F
>
> 1 DATA PREZZO DATA PREZZO
> 2 05/01/16 1 05/01/16 1
> 3 05/01/16 2 05/01/16 2
> 2 05/01/16 1 05/01/16 1
> 3 05/01/16 2 05/01/16 2
> 2 05/01/16 1 05/01/16 1
> 3 08/01/16 2 10/01/16 2
>
> Grazie mille per la disponibilità.
> Edoardo
Prova qualcosa del genere:
'=========>>
Option Explicit
'--------->>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range, Rng2 As Range
Const sColonnePrezzi As String = _
"B:B,D:D,G:G,J:J" '<<=== Modifica
Set Rng = Intersect(Me.Range(sColonnePrezzi), Target)
If Not Rng Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
With Rng.Offset(0, -1)
.Value = Now
.NumberFormat = "dd/mm/yyyy hh:mm"
End With
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=========
Se volessi anche limitare l'azione della macro ad un determonato
intervallo di righe, potresti provare la seguente versione:
'=========>>
Option Explicit
'--------->>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range, Rng2 As Range
Const sColonnePrezzi As String = _
"B:B,D:D,G:G,J:J" '<<=== Modifica
Const sRighe As String = "2:14" '<<=== Modifica
Set Rng = Intersect(Me.Range(sColonnePrezzi), Target)
If Not Rng Is Nothing Then
Set Rng2 = Intersect(Rng, Me.Rows(sRighe))
End If
If Not Rng2 Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
With Rng2.Offset(0, -1)
.Value = Now
.NumberFormat = "dd/mm/yyyy hh:mm"
End With
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=========
===
Regards,
Norman