Notifications
Clear all

EXECUTAR MACRO A PARTIR DA DATA DE "HOJE"

2 Posts
2 Usuários
0 Reactions
991 Visualizações
(@denilsonsl)
Posts: 84
Trusted Member
Topic starter
 

Boa tarde Galera.

uso esse codigo em uma planilha:

Private Sub Worksheet_Change(ByVal Target As Range)

    Application.ScreenUpdating = False

    If Application.Intersect(Target, Range("E2:E30000")) Is Nothing Then Exit Sub

    If Target.Value <> "R" Then
    
    Else
    
    Plan10.Range("A3:Z200").ClearContents 'comando que limpa as linhas da planilha espelho
    ultimalinha = Plan1.Cells(Rows.Count, "a").End(xlUp).Row
    
    Lin = 2
        
        For R = 2 To ultimalinha
            If Plan1.Cells(R, 5) <> "" Then
            Plan10.Cells(Lin, 1) = Plan1.Cells(R, 1)
            Plan10.Cells(Lin, 6) = Plan1.Cells(R, 6)
            Plan10.Cells(Lin, 7) = Plan1.Cells(R, 7)
            Plan10.Cells(Lin, 8) = Plan1.Cells(R, 8)
            Plan10.Cells(Lin, 9) = Plan1.Cells(R, 9)
            Plan10.Cells(Lin, 10) = Plan1.Cells(R, 10)
            Plan10.Cells(Lin, 11) = Plan1.Cells(R, 11)
            Plan10.Cells(Lin, 12) = Plan1.Cells(R, 12)
            Plan10.Cells(Lin, 13) = Plan1.Cells(R, 13)
            'Plan10.Cells(Lin, 14) = Plan1.Cells(R, 14)
            Plan10.Cells(Lin, 16) = Plan1.Cells(R, 16)
            Plan10.Cells(Lin, 17) = Plan1.Cells(R, 17)
            Plan10.Cells(Lin, 18) = Plan1.Cells(R, 18)
            Plan10.Cells(Lin, 19) = Plan1.Cells(R, 19)
            Plan10.Cells(Lin, 20) = Plan1.Cells(R, 20)
            Plan10.Cells(Lin, 21) = Plan1.Cells(R, 21)
            Plan10.Cells(Lin, 22) = Plan1.Cells(R, 22)
            Plan10.Cells(Lin, 23) = Plan1.Cells(R, 23)
            Plan10.Cells(Lin, 24) = Plan1.Cells(R, 24)
            Plan10.Cells(Lin, 25) = Plan1.Cells(R, 25)
            Plan10.Cells(Lin, 26) = Plan1.Cells(R, 26)
            Plan10.Cells(Lin, 26) = Plan1.Cells(R, 26)
            Plan10.Cells(Lin, 27) = Plan1.Cells(R, 27)
            Plan10.Cells(Lin, 28) = Plan1.Cells(R, 28)
            Plan10.Cells(Lin, 29) = Plan1.Cells(R, 29)
            Plan10.Cells(Lin, 30) = Plan1.Cells(R, 30)
            Lin = Lin + 1
            
            End If
        Next
        
    End If
    
    ActiveWorkbook.Save
    
    Application.ScreenUpdating = True

End Sub

Como faço para que esse codigo seja executado com a data de "hoje" em uma celula ao invez de executar so a partir desse codigo "If Target.Value <> "R" Then"

 
Postado : 01/07/2016 11:26 am
(@osvaldomp)
Posts: 857
Prominent Member
 
If Target.Value <> "R" And [A1] = Date Then

Osvaldo

 
Postado : 01/07/2016 2:15 pm