To hide column based on slicer selectionHow to avoid using Select in Excel VBAtrend analysis and conditional formatting with Excel Pivot TableExcel VBA - Check Report Slicer Selections (Skip if ALL are selected)Poor performance updating Excel slicer selection using VBAHide PivotChart columnsPowerPivot function/Target year Slicer issueProgrammatically select today's date on SlicerCalculate monthly average from daily data without PivotTableHow to remove a blank row from slicer?Selecting multiple slicer items based on a cell value

What is the parallel of Day of the Dead with Stranger things?

Received a dinner invitation through my employer's email, is it ok to attend?

Efficiently defining a SparseArray function

WTB Horizon 47c - small crack in the middle of the tire

Credit score and financing new car

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

How do you move up one folder in Finder?

What attributes and how big would a sea creature(s) need to be able to tow a ship?

Graduate student with abysmal English writing skills, how to help

How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

The three greedy pirates

How can I effectively communicate to recruiters that a phone call is not possible?

Why did Old English lose both thorn and eth?

Addressing unnecessary daily meetings with manager?

What happens when adult Billy Batson says "Shazam"?

Is it possible to split a vertex?

Why do we need common sense in AI?

Misrepresented my work history

Why different specifications for telescopes and binoculars?

Why archangel Michael didn't save Jesus when he was crucified?

Chorophyll and photosynthesis in plants with coloured leaves

Why would people still be chanting "Lock her up" at Trump rallies in 2019?

What is the correct parsing of お高くとまる?



To hide column based on slicer selection


How to avoid using Select in Excel VBAtrend analysis and conditional formatting with Excel Pivot TableExcel VBA - Check Report Slicer Selections (Skip if ALL are selected)Poor performance updating Excel slicer selection using VBAHide PivotChart columnsPowerPivot function/Target year Slicer issueProgrammatically select today's date on SlicerCalculate monthly average from daily data without PivotTableHow to remove a blank row from slicer?Selecting multiple slicer items based on a cell value






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have sales data. The last two columns are projection an agent ends at a month and the next is where he/she will end at the year. I have a slicer for Time period that has months and one option is YTD.
What I want is, if someone selects YTD, it hides the column "J", that has monthly numbers. I have very little knowledge about vba, i copied from here and there. but it doesn't work.



Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If ActiveWorkbook.SlicerCaches("Slicer_end_of_mnth").SlicerItems("YTD").Selected = True Then
Columns("J:J").Hidden = True
Else
Columns("J:J").Hidden = False
End If
End Sub









share|improve this question
























  • Can you explain what doesn't work? Do you get an error message?

    – BigBen
    Mar 26 at 0:48

















0















I have sales data. The last two columns are projection an agent ends at a month and the next is where he/she will end at the year. I have a slicer for Time period that has months and one option is YTD.
What I want is, if someone selects YTD, it hides the column "J", that has monthly numbers. I have very little knowledge about vba, i copied from here and there. but it doesn't work.



Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If ActiveWorkbook.SlicerCaches("Slicer_end_of_mnth").SlicerItems("YTD").Selected = True Then
Columns("J:J").Hidden = True
Else
Columns("J:J").Hidden = False
End If
End Sub









share|improve this question
























  • Can you explain what doesn't work? Do you get an error message?

    – BigBen
    Mar 26 at 0:48













0












0








0








I have sales data. The last two columns are projection an agent ends at a month and the next is where he/she will end at the year. I have a slicer for Time period that has months and one option is YTD.
What I want is, if someone selects YTD, it hides the column "J", that has monthly numbers. I have very little knowledge about vba, i copied from here and there. but it doesn't work.



Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If ActiveWorkbook.SlicerCaches("Slicer_end_of_mnth").SlicerItems("YTD").Selected = True Then
Columns("J:J").Hidden = True
Else
Columns("J:J").Hidden = False
End If
End Sub









share|improve this question
















I have sales data. The last two columns are projection an agent ends at a month and the next is where he/she will end at the year. I have a slicer for Time period that has months and one option is YTD.
What I want is, if someone selects YTD, it hides the column "J", that has monthly numbers. I have very little knowledge about vba, i copied from here and there. but it doesn't work.



Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If ActiveWorkbook.SlicerCaches("Slicer_end_of_mnth").SlicerItems("YTD").Selected = True Then
Columns("J:J").Hidden = True
Else
Columns("J:J").Hidden = False
End If
End Sub






excel vba pivot-table slicers






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 0:32









BigBen

8,5693 gold badges8 silver badges21 bronze badges




8,5693 gold badges8 silver badges21 bronze badges










asked Mar 26 at 0:30









ShobiShobi

228 bronze badges




228 bronze badges












  • Can you explain what doesn't work? Do you get an error message?

    – BigBen
    Mar 26 at 0:48

















  • Can you explain what doesn't work? Do you get an error message?

    – BigBen
    Mar 26 at 0:48
















Can you explain what doesn't work? Do you get an error message?

– BigBen
Mar 26 at 0:48





Can you explain what doesn't work? Do you get an error message?

– BigBen
Mar 26 at 0:48












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348250%2fto-hide-column-based-on-slicer-selection%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348250%2fto-hide-column-based-on-slicer-selection%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴