-1
I made a program in VBA to calculate the cost in my company. For this I used two connections with the Oracle database. What’s strange is the fact that when I try to use the advanced filter manually, it works. However, when I try to use the VBA (written through macro using the filter manually), it does not work.
Sub custo()
'atualizacao da data
For Each c In Worksheets("BD2").Range("B1:B152")
If c.Value <> "MOV_DATMOV" Then
c.Value = ">" & DateAdd("yyyy", -1, Date)
Else
c.Value = "MOV_DATMOV"
End If
Next c
For Each d In Worksheets("BD2").Range("C1:C152")
If d.Value <> "MOV_DATMOV" Then
d.Value = "<" & Date
Else
d.Value = "MOV_DATMOV"
End If
Next d
'filtro de todas as despesas
'desp 001
Sheets("BD1").Columns("J:T").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("BD2").Range("A1:C2"), CopyToRange:=Sheets("CP").Range("A2"), _
Unique:=False
The spreadsheets I use in loops are:
Sorry, I made a huge mistake of thinking I had posted in the international. I have already done the translation
– Drago