Double Click Macro that creates new sheet using SQL query

NotVeryGoodAtBI

New Member
Joined
Mar 11, 2024
Messages
3
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
Platform
  1. Windows
Hello, I am still in the process of learning macros, and I was tasked with the following scenario, please help steer me in the right direction!

I have an excel workbook that is populated with lots of pricing information. Column A is the product_ID and I want column AP to be the lowest competitor price for that product_ID. I also have a SQL table named Competitive_Pricing with all competitors prices for each product ID, and a query that uses product_id to pull all competitor pricing for that inputted product_ID.


I would first want to create a macro that populates column AP with the lowest competitor price by plugging in the Product_ID from column A into a query that pulls lowest price for that inputted product_ID, then another macro that when a user double clicks on a cell in column AP (lowest competitor price for that product_id in column A) it creates new sheet. This new sheet would be populated by plugging in Product_ID from column A into my SQL query, pulling all competitor pricing for that specific product_id. Once the user clicks onto a different tab than the created sheet would disappear.

Can anyone please help me write the VBA code that would be used to do this?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Double Click Macro that creates new sheet using SQL query (Please Help!!) =)
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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