Thanks Vaibhav, it worked. This group is really amazing. Thanks for your support and help. Thanks and Regards, Nitin Balodi
From: v...@vabs.in Date: Mon, 2 Feb 2015 12:59:48 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com Hi Code amended.. Check Attachment, Cheers!! On Mon, Feb 2, 2015 at 2:39 AM, Nitin Balodi <nitinbal...@live.com> wrote: Hi Vaibhav, Attached is the sample data file. Regards. Yours Sincerely,Nitin Balodi From: v...@vabs.in Date: Sat, 31 Jan 2015 20:07:02 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com Hi Share sample chart.. On Fri, Jan 30, 2015 at 8:32 PM, Nitin Balodi <nitinbal...@live.com> wrote: Vaibhav, its giving me subscript out of range error. I am thinking if we have to put Sheet name before range (like Sheet1!Range1, Sheet1!Range2). I have chart and data in the same sheet and tried to include sheet name also, but of no use (getting type mismatch error). Regards. Yours Sincerely,Nitin Balodi From: v...@vabs.in Date: Fri, 30 Jan 2015 18:18:09 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com try Charts("Chart1").SetSourceData Source:=application.union(Range1,Range2) Cheers!!ᐧ On Fri, Jan 30, 2015 at 5:59 PM, Nitin Balodi <nitinbal...@live.com> wrote: Hi Vaibhav, and that worked..... :) :) :) many thanks. I was trying to set date serial using left function. Many thanks once again. Can you help on one more thing, and that will complete my current task :), I am trying to set Chart range. My range is in columns A, B and D. Set Range1 = Range("A" & StartRow & ":B" & EndRow)Set Range2 = Range("D" & StartRow & ":D" & EndRow) Charts("Chart1").SetSourceData Source:=Range(Range1, Range2) I also tried different things like: Charts("Chart1").SetSourceData Source:=Range("A" & StartRow & ":B" & EndRow, Range2) Regards. Yours Sincerely,Nitin Balodi From: v...@vabs.in Date: Thu, 29 Jan 2015 21:53:29 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com check this... cheers!!ᐧ On Thu, Jan 29, 2015 at 9:26 PM, Nitin Balodi <nitinbal...@live.com> wrote: Hi Vaibhav, I have tried using below code but it is giving only the last record of yesterday date after it run through the loop, I did tried to do some editing to the code but of no use :( and yes the sheet name is Pivot and Pivot Table name is PivotTable1. Regards. Yours Sincerely,Nitin Balodi From: v...@vabs.in Date: Tue, 27 Jan 2015 21:07:40 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com there is workaround..try bellow code.. Sub abc()Dim Field As PivotField, fDateSet Field = Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Created Date")fDate = DateSerial(2015, 1, 23) * 1With Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Created Date") .Orientation = xlPageField .Position = 1 .EnableMultiplePageItems = TrueEnd WithSheets("Pivot").PivotTables("PivotTable1").ClearAllFilters With FieldOn Error Resume NextFor i = 1 To Field.PivotItems.Count' Debug.Print Left(.PivotItems(i).Value, 10)tt = Left(.PivotItems(i).Value, 10)cmpDt = DateSerial(Right(tt, 4), Left(tt, 2), Mid(tt, 4, 2)) * 1 If cmpDt <> fDate Then .PivotItems(i).Visible = False Else .PivotItems(i).Visible = True End IfNext i End With End Sub Cheers!! ᐧ On Tue, Jan 27, 2015 at 8:46 PM, Vaibhav Joshi <v...@vabs.in> wrote: Is your pivot table in Sheet name Pivot & it should be 1st pivot table in your sheet, Also check date format, you need to give exact same format i.e. m/d/y hh:ss. Colb has date & time format while you are giving only date in filter. ᐧ On Tue, Jan 27, 2015 at 8:17 PM, Nitin Balodi <nitinbal...@live.com> wrote: Hi Vaibhav, Thanks for your response. I have tried code you had suggested but it showing me object defined or application defined error. Regards. Yours Sincerely,Nitin Balodi From: v...@vabs.in Date: Tue, 27 Jan 2015 16:50:17 +0530 Subject: Re: $$Excel-Macros$$ Date Filters in Pivot Table Report Filter in VBA To: excel-macros@googlegroups.com Instead of ActiveSheet you can also use: Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Created Date").CurrentPage _ = #1/25/2015#ᐧ On Tue, Jan 27, 2015 at 4:48 PM, Vaibhav Joshi <v...@vabs.in> wrote: Hi Since it is report filter your method wont work.. you can try replacing last line with with following two or last one only... Sheets("Pivot").PivotTables("PivotTable1").ClearAllFiltersActiveSheet.PivotTables("PivotTable1").PivotFields("Created Date").CurrentPage _ = #1/23/2015# Cheers!! ᐧ On Tue, Jan 27, 2015 at 2:56 AM, Nitin Balodi <nitinbal...@live.com> wrote: Hi Experts, I am having some issues in filtering data in pivot tables and require your help. I have to filter all the data of yesterday date in pivot table. I have added Created Date column to Page Field using VBA but unable to filter out data with Create date of yesterday. Please refer to attached file for your reference. Code snippet I had written is: With Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Created Date") .Orientation = xlPageField .Position = 1 .EnableMultiplePageItems = TrueEnd WithSheets("Pivot").PivotTables("PivotTable1").PivotFields("Created Date").PivotFilters.Add Type:=xlSpecificDate, Value1:="01/23/2015" Many thanks for your help in advance. Regards. Yours Sincerely,Nitin Balodi -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.