Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao MAr585,
Questo è il link di we transfer: https://we.tl/t-fvpfdYSo7L
Grazie in anticipo
- Fai clic dx sulla linguetta del foglio ATTIVE
- Seleziona l'opzione Visualizza Codice dal **** menu contestuale risultante
- Incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim destSH As Worksheet
Dim rng As Range, rCell As Range
Dim destRng As Range
Dim LRow As Long
Const sParola_Chiave As String = "DISMESSA" '<<=== Modifica
Const sFoglio_Destinazione As String = "DISMESSE" '<<=== Modifica
Set rng = Intersect(Me.Columns(1), Target)
If Not rng Is Nothing Then
Set destSH = ThisWorkbook.Sheets(sFoglio_Destinazione)
With destSH
LRow = LastRow(destSH, .Columns("A:A"))
Set destRng = .Range("A" & LRow + 1).Resize(1, 26)
End With
For Each rCell In rng.Cells
With rCell
If .Value = sParola_Chiave Then
On Error GoTo XIT
Application.EnableEvents = False
.Resize(1, 26).Cut
Application.Goto destRng
ActiveSheet.Paste
End If
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Fai clic dx sulla linguetta del foglio DISMESSE
- Seleziona l'opzione Visualizza Codicedal****menu contestuale risultante
- Incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim destSH As Worksheet
Dim rng As Range, rCell As Range
Dim destRng As Range
Dim LRow As Long
Const sParola_Chiave As String = "ATTIVA" '<<=== Modifica
Const sFoglio_Destinazione As String = "ATTIVE" '<<=== Modifica
Set rng = Intersect(Me.Columns(1), Target)
If Not rng Is Nothing Then
Set destSH = ThisWorkbook.Sheets(sFoglio_Destinazione)
With destSH
LRow = LastRow(destSH, .Columns("A:A"))
Set destRng = .Range("A" & LRow + 1).Resize(1, 26)
End With
For Each rCell In rng.Cells
With rCell
If .Value = sParola_Chiave Then
On Error GoTo XIT
Application.EnableEvents = False
.Resize(1, 26).Cut
Application.Goto destRng
ActiveSheet.Paste
End If
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
'<<=========
- Alt+IM per inserire un nuovo modulo di codice
- Nel nuovo modulo vuoto, incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Public Function LastRow(SH As Worksheet, _
Optional rng As Range, _
Optional minRow As Long = 1, _
Optional sPassword As String)
Dim bProtected As Boolean
With SH
If rng Is Nothing Then
Set rng = .Cells
End If
bProtected = .ProtectContents = True
If bProtected Then
Application.ScreenUpdating = False
.Unprotect Password:=sPassword
End If
End With
On Error Resume Next
LastRow = rng.Find(What:="*", _
after:=rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
If LastRow < minRow Then
LastRow = minRow
End If
If bProtected Then
SH.Protect Password:=sPassword, _
UserInterfaceOnly:=True
End If
Application.ScreenUpdating = True
End Function
'<<=========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Salva il file con l’estensione xlsm
Potresti scaricare il mio file di prova MAr20190625.xlsm
===
Regards,
Norman