Changing button colour/properties on click

CaptFirePanda

New Member
Joined
Apr 5, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm setting up a dashboard with buttons to display chart data based on the selected button. I've been using the solution provided by smozgur laid out here: https://www.mrexcel.com/board/threads/change-button-color-upon-click.1173075/post-5715010

I'm running into an issue where I can get most of the buttons to do what I'm hoping they will do. The only exception is the "Oil Consumption: South East Asia" button - when I click it, the LNG Imports: South East Asia button changes instead.

I've named all of the buttons and grouped the LNG and Oil buttons into separate named groups. I've also built separate macros for each of them. Attached is what I've done for the Oil buttons - the LNG macros are set up in the same way.

It would be great if someone can see what I'm missing or have done incorrectly. I'm still a novice with VBA so I'm sure that I've made a fairly simple mistake but don't have the experience to identify it. Also, I'm comfortable with smozgur's solution so there's no need to develop a better solution unless it takes minimal effort on your part.

Thanks in advance.
 

Attachments

  • Dashboard.PNG
    Dashboard.PNG
    63.1 KB · Views: 22
  • OilMacros1.PNG
    OilMacros1.PNG
    26.1 KB · Views: 23
  • OilMacros2.PNG
    OilMacros2.PNG
    23.3 KB · Views: 22

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi,
The very first thing to do is to go and check the exact name of each and every one of your shapes, since a tiny mistake can disrupt your code ...
 
Upvote 0
Solution
Hi,
The very first thing to do is to go and check the exact name of each and every one of your shapes, since a tiny mistake can disrupt your code ...
Wow... after painstakingly going through them a few times now, I discover that the "Oil Consumption: South East Asia" button name was wrong. Not sure why I didn't catch it previously.
Anyway, thanks for the advice, James!
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,479
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top