• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Date vba code help me

noppo123

New Member
Hello friedns;

selects only specified dates in cell G3-G4
does not select date range


19.05.2019 - 21.05.2019 why doesn't choose date between 20.05.2019

please help me


60923

Code:
Sub tar()



    ActiveSheet.PivotTables("PivotTable1").CubeFields(39).EnableMultiplePageItems _
        = True
Tarih = Format(Range("G3"), "yyyy-mm-dd") & "T00:00:00"
Tarih2 = Format(Range("G4"), "yyyy-mm-dd") & "T00:00:00"
    ActiveSheet.PivotTables("PivotTable1").PivotFields( _
        "[TakvimUL].[Yıl -  Hafta -  Gun].[Yıl]").VisibleItemsList = Array("")
    ActiveSheet.PivotTables("PivotTable1").PivotFields( _
        "[TakvimUL].[Yıl -  Hafta -  Gun].[Hafta]").VisibleItemsList = Array("")
    ActiveSheet.PivotTables("PivotTable1").PivotFields( _
        "[TakvimUL].[Yıl -  Hafta -  Gun].[Gun]").VisibleItemsList = Array( _
        "[TakvimUL].[Yıl -  Hafta -  Gun].[Gun].&[" & Tarih & "]", _
        "[TakvimUL].[Yıl -  Hafta -  Gun].[Gun].&[" & Tarih2 & "]")
End Sub
 
noppo123
Seems that You neither read sentence ... 'Someone else...'.

Your Array has TWO values (19.05.2019 AND 21.05.2019) - okay?
but seems that You would like to have values FROM (19.05.2019) TO (21.05.2019) - okay?
You have to tell that to Excel the way Excel would understand it.

Now, You're asking code ...
You should upload a sample Excel-file,
that someone would check/verify that Your code would work after make it work.
I won't even start to thinking this more, if I cannot check/verify that it would work!
 
( Your Array has TWO values (19.05.2019 AND 21.05.2019) - okay? ) YES

( but seems that You would like to have values FROM (19.05.2019) TO (21.05.2019) - okay? ) YES İ WANT İT


but the excel file does not work in your turn when it pulls sql based data ( data it only works on me )
my english sucks sorry for exhausting you
 

Attachments

  • Kitap1 - Copy.xlsm
    20.8 KB · Views: 2
noppo123
Why did You upload a file which do not have Your code?
Which Excel-version do You use?
.... because Your 'Pivot-table' seems NOT work with my version.
 
Back
Top