In Userform1 use the code below:
Dim wsR As Worksheet
Dim wsD As Worksheet
Dim ul As Long
If cdDataINI <> "" Or cdDataFIM <> "" Then
Set wsR = ThisWorkbook.Sheets("RELATORIO")
ul = wsR.Cells(wsR.Rows.Count, 1).End(xlUp).Row
If wsR.Range("XFC1").Value = "" Then
wsR.Range("F1").Copy wsR.Range("XFC1:XFD1")
End If
wsR.Range("A1:G" & ul + 1).ClearContents
wsR.Range("XFC2").Value = ">=" & Format(cdDataINI, "mm/dd/yyyy")
wsR.Range("XFD2").Value = "<=" & Format(cdDataFIM, "mm/dd/yyyy")
Set wsD = ThisWorkbook.Sheets("dados")
ul = wsD.Cells(wsD.Rows.Count, 1).End(xlUp).Row
On Error Resume Next
wsD.Range("A1:G" & ul).AdvancedFilter xlFilterCopy, wsR.Range("XFC1:XFD2"), wsR.Range("A1"), False
MsgBox "Processo concluído - " & cdDataINI & " à " & cdDataFIM
End If
Please enter your tried codes or more information so we can help. See how to ask.
– Felipe Augusto
ok corrected topic
– Rafael Portela