Página 1 de 1

Log de alterações

Enviado: 06 Out 2017 às 11:11
por JayltonLuiz
Boa tarde,Com a ajuda do pessoal do fórum consegui montar minha planilha de alterações de log,mais tive um problema quando aba log registra 64 alterações para de gravar.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("c")) Is Nothing Then
For iCol = 1 To Target.Columns.Count
Set iCell = Target(iRow, iCol)
Plan4.Range("E" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, -2)
Plan4.Range("F" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 0)
Plan4.Range("C" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = VBA.Environ("username")
Plan4.Range("B" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Now()
Plan4.Range("A" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = iCell.Address(0, 0)
Plan4.Range("D" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 7)
NowValue = Now
If iLogRow Mod 100 = 0 Then DoEvents
Next iCol
ElseIf Not Intersect(Target, Columns("F")) Is Nothing Then
For iCol = 1 To Target.Columns.Count
Set iCell = Target(iRow, iCol)
Plan4.Range("E" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, -2)
Plan4.Range("F" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 0)
Plan4.Range("C" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = VBA.Environ("username")
Plan4.Range("B" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Now()
Plan4.Range("A" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = iCell.Address(0, 0)
Plan4.Range("D" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 4)
NowValue = Now
If iLogRow Mod 100 = 0 Then DoEvents
Next iCol
ElseIf Not Intersect(Target, Columns("I")) Is Nothing Then
For iCol = 1 To Target.Columns.Count
Set iCell = Target(iRow, iCol)
Plan4.Range("E" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, -2)
Plan4.Range("F" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 0)
Plan4.Range("C" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = VBA.Environ("username")
Plan4.Range("B" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Now()
Plan4.Range("A" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = iCell.Address(0, 0)
Plan4.Range("D" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Target.Offset(0, 1)
NowValue = Now
If iLogRow Mod 100 = 0 Then DoEvents
Next iCol
End If
End Sub

Re: Log de alterações

Enviado: 07 Out 2017 às 16:51
por babdallas
Anexa a sua planilha, por favor. Facilita a compreensão.

Re: Log de alterações

Enviado: 09 Out 2017 às 09:37
por JayltonLuiz
Bom Dia,

Anexado.

Obrigado

Re: Log de alterações

Enviado: 09 Out 2017 às 11:06
por babdallas
Veja se é isso oq quer.