Active Member
Power BI
May 17, 2019
Good Morning, I have been trying to resolve an issue for some 2 weeks whereby I have been using WS_Change Event to lookup data and now reading Phillip’s article yet again (properly this time), I realise it may be WS_SelectionChange that I should be using although still have issues using either alternative.
Use: In the Summary WS of the attached (where the Change Event is), Line 27 is the top row of a table, there is a dropdown data validated list on C27 from which the user should select a StockCode and the Event returns the Description from the SqlData table. I also want to return the Group and Selling Price when I can get it working correctly. Tab through the remaining cells to add a new line to the Table and repeat the process as often as required thereby expanding the Table.
Using WS Change: 1st line populates correctly but tab to 2nd and subsequent lines, repeats the Description across all cells in the line and also adds an additional column on each line.
Using WS SelectionChange: “flashes” on StockCode Cell and Validation List selector disappears. It is only by putting a break on the code that allows user input to the Drop Down Selection that a code can be selected. After that, it correctly adds the Description and tabbing through correctly adds the new line with correct number of columns and then this series of actions repeats.
I have tried Enable/Disable Events but without much success due to my lack of understanding.
I’m sorry if this explanation appears excessive but I didn’t want to waste anybody’s time who was prepared to try and assist with this problem and thank you in anticipation of any assistance or suggestions offered.
Active Member
Power BI
May 17, 2019
'Morning Phil, thanks for the reply
Yes, I had already got this working with Index & Match (as the Group column would have required a negative Lookup) as a Backup. However, as the data is then to be used elsewhere, you would need to make them all the Index/Match permanent by Copy & Paste Special of the 3 formulas over what may be anything from 10 to 00's or even a 1000 or so lines.
I was also trying to increase my knowledge and use of VBA by getting the Change Events functionality working as it will come up again in a future requirement.
Thank you for looking, I appreciate your time!
Active Member
Power BI
May 17, 2019
'Morning Phil, yes, I realise that the formulas will copy in a table but when the user has finished building the table with n number of additional rows, that block of data is to be moved elsewhere and everything will Error unless Copy/Paste is used. I wanted to avoid showing the formula and then dealing with Copy/Paste by making the whole thing appear seemless by employing WS Selection or Change Events and it seemed a perfect opportunity to use the VBA functionality to perform the task and I know it will come in useful in the future if I could master the technique on this piece of work.
Thanks again for looking