RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 801
- Office Version
- 365
- Platform
- Windows
Hi guys, two ways to look at a solution to this problem.
I have a scatter chart on a sheet called Curves, and the data for this chart is held on a sheet called Database. I have loaded up about 6 slicers for Database which are located on Curves. The user can select slicers in sequence to filter the data through different levels. Think of it like "Groceries > Fruit > Apple > Green > Granny Smith" or something like that
What I want to do is return a lookup once the last level is triggered. This slicer is called Asset as it pertains to the Asset column on the Database. I want a lookup to then use the Asset as the lookup value, against the Database table and return the result in the column called "Primary UoM". In the above example, once "Granny Smith" is selected it would return "Weight (g)" for instance.
I'm trying to think of a way to do it and have been spending all morning prompting ChatGPT but it's giving me fairly by-the-numbers solutions that involve basically checking the worksheet every time a change or calculation is made.
In my head, an ideal solution would be for a macro to detect column G (Asset) has been filtered in the Database tab, in which case the Primary UoM's will all be the same, and therefore just return the Primary UoM (column P) of the first visible row.
This doesn't seem to be possible, however, and therefore I'm left stuck. ChatGPT's solution could work, but looking at the code it looks incredibly fragile and I think functionality would stop as it requires EnableEvents etc, which I've found to be quite temperamental in the past.
Any ideas would be appreciated!
I have a scatter chart on a sheet called Curves, and the data for this chart is held on a sheet called Database. I have loaded up about 6 slicers for Database which are located on Curves. The user can select slicers in sequence to filter the data through different levels. Think of it like "Groceries > Fruit > Apple > Green > Granny Smith" or something like that
What I want to do is return a lookup once the last level is triggered. This slicer is called Asset as it pertains to the Asset column on the Database. I want a lookup to then use the Asset as the lookup value, against the Database table and return the result in the column called "Primary UoM". In the above example, once "Granny Smith" is selected it would return "Weight (g)" for instance.
I'm trying to think of a way to do it and have been spending all morning prompting ChatGPT but it's giving me fairly by-the-numbers solutions that involve basically checking the worksheet every time a change or calculation is made.
In my head, an ideal solution would be for a macro to detect column G (Asset) has been filtered in the Database tab, in which case the Primary UoM's will all be the same, and therefore just return the Primary UoM (column P) of the first visible row.
This doesn't seem to be possible, however, and therefore I'm left stuck. ChatGPT's solution could work, but looking at the code it looks incredibly fragile and I think functionality would stop as it requires EnableEvents etc, which I've found to be quite temperamental in the past.
Any ideas would be appreciated!