• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Changing chart and types using VBA - and eliminate the requirement for macros. |VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Changing chart and types using VBA - and eliminate the requirement for macros. |VBA & Macros|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosChanging chart and types using VBA…
sp_PrintTopic sp_TopicIcon
Changing chart and types using VBA - and eliminate the requirement for macros.
Avatar
Andy White
Member
Members

Dashboards

Power Query
Level 0
Forum Posts: 11
Member Since:
October 28, 2021
sp_UserOfflineSmall Offline
1
February 12, 2022 - 9:24 pm
sp_Permalink sp_Print

Good Morning All....

My Problem!!

I have my excel dashboard working thanks to the advice from the kind and knowledgeable members of the forum.  Special thanks has to go to Velouria for all his help.

Unfortunately, my work has now disabled macros in excel due to corporate requirements so my dashboard no longer functions correctly.

Macros were used to set the chart to combo and set the chart types whenever the pivot table updates, as if any data was missing or selection invalid, it reset the chart type etc..  I’m informed this is an issue with excel and macro’s are the only way to get around it?  

So my Question is …..   Can this be done without a macro and purely VBA??

 

I have inserted the details below of the code on my worksheet and macro.

 

Code on Worksheet with Pivot Table.  Worksheet  = "Prod Hub (Pivot& Graph)"

                                                                     Pivot Table =  “Pivot Table1”

Pivot Table changes by slicers on “Site Dashboard” worksheet.

 

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

 

If Target.Name = "PivotTable1" Then

Sheets("Site Dashboard").Activate

Application.Run "'HUB FINALaw.xlsm'!Test2"

 

End If

End Sub

--------------------------------------------------------------------------------

Test2 Macro

Sub Test2()

'

' Test2 Macro

    On Error Resume Next

    ActiveSheet.ChartObjects("Chart 10").Activate

    ActiveSheet.ChartObjects("Chart 10").Activate

    ActiveChart.ChartType = xlColumnClustered

    ActiveChart.FullSeriesCollection(1).ChartType = xlColumnClustered

    ActiveChart.FullSeriesCollection(1).AxisGroup = 1

    ActiveChart.FullSeriesCollection(2).ChartType = xlColumnClustered

    ActiveChart.FullSeriesCollection(2).AxisGroup = 1

    ActiveChart.FullSeriesCollection(3).ChartType = xlLine

    ActiveChart.FullSeriesCollection(3).AxisGroup = 1

    ActiveChart.FullSeriesCollection(1).ChartType = xlLine

    ActiveChart.FullSeriesCollection(2).ChartType = xlLine

    ActiveChart.FullSeriesCollection(3).ChartType = xlColumnClustered

    On Error GoTo 0

 

End Sub

Any help greatly appreciated.

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
February 14, 2022 - 1:07 pm
sp_Permalink sp_Print

Hi Andy,

Macros are another term for the code written using VBA.  So macros = VBA.

If macros/VBA were the only way to do what you want, then I'm afraid you are stuck.

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Tom VAN LOO, Misael Gutierrez Sr.
Guest(s) 5
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Cathi Giard
Sarah Young
Henry Delgado
Alita Nieuwoudt
KL KOH
Joao Marques
Regi Hampton
Taffie Elliott
Paramita Chakraborty
David du Toit
Forum Stats:
Groups: 3
Forums: 24
Topics: 6358
Posts: 27805

 

Member Stats:
Guest Posters: 49
Members: 32335
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.