VBA to update connection string based on value of a cell

emilyallison

New Member
Joined
Feb 3, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have a connection string that contains an identity catalog that is unique to each location. I want to be able to run a script to update the connection string based on value of a cell in my workbook. I'm not familiar with VBA so I'm struggling to understand where I need to start.

Thank you in advance!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Probably the easy way to do it for a newbie will be by using a named range in a worksheet.
Then your VBA code could load into this cell each connection string in a loop (well as a matter of fact it can be just name, not a cell, but a cell will make debugging easier). Then you can refresh the query, do your tasks with the query output and let the loop load next location parameters into thics cell and so on.

How to replace "hardcoded" connection with named range - see for instance Change the Power Query source based on a cell value
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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