Página 1 de 1

Juntar dois Worksheet em uma mesma planilha

Enviado: 13 Jun 2018 às 08:55
por Leonardo7
Prezados amigos,

Estou com um problema para executar dois Worksheet na mesma planilha. Gostaria do apoio de vcs para juntar os Worksheet descrito abaixo.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim hVal
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("b12:e42")) Is Nothing Then Exit Sub
With Target
hVal = Format(.Value, "0000")
If IsNumeric(hVal) And Len(hVal) = 4 Then
Application.EnableEvents = False
.Value = Left(hVal, 2) & ":" & Right(hVal, 2)
.NumberFormat = "[h]:mm"
End If
End With
Application.EnableEvents = True
End Sub

e

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$Q$6" Then
Range("B12:E42").ClearContents
Range("P12:p42").ClearContents
End If

End Sub

Re: Juntar dois Worksheet em uma mesma planilha

Enviado: 13 Jun 2018 às 10:17
por osvaldomp
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)
 Dim hVal
  If Target.Count > 1 Then Exit Sub
   If Not Intersect(Target, Range("B12:E42")) Is Nothing Then
    With Target
     hVal = Format(.Value, "0000")
     If IsNumeric(hVal) And Len(hVal) = 4 Then
      Application.EnableEvents = False
      .Value = Left(hVal, 2) & ":" & Right(hVal, 2)
      Application.EnableEvents = True
      .NumberFormat = "[h]:mm"
     End If
    End With
   ElseIf Target.Address = "$Q$6" Then
    Range("B12:E42,P12:P42").ClearContents
   End If
End Sub