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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현