Jump to content
Fórum Script Brasil
  • 0

FORMATO DE DATA VBA


Question

Boa tarde, tenho um código que filtra uma tabela pela data. Porém, está dando erro, pois, o VBA não entende que o formato que está na CÉLULA é dd/mm/yyyy, ele entende mm/dd/yyyy.

Alguém pode me ajudar ?

Sub Filtro_Data()
Application.Calculation = xlAutomatic

Dim data_ini As Date
Dim data_fin As Date


data_ini = DateValue(Format(Range("F2"), "dd/mm/yyyy"))
data_fin = DateValue(Format(Range("G2"), "dd/mm/yyyy"))
Sheets("BACABA").Select
Selection.AutoFilter
ActiveSheet.Range("$c$5:d$50000").AutoFilter Field:=2, Criteria1:= _
">=" & data_ini, Operator:=xlAnd, Criteria2:="<=" & data_fin



End Sub

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Cloud Computing


  • Forum Statistics

    • Total Topics
      148906
    • Total Posts
      644997
×
×
  • Create New...