excel-external-data

How to use parameterized query in Excel using column as parameter?

泪湿孤枕 提交于 2019-12-17 16:39:15
问题 I am trying to develop a spreadsheet that can locate corresponding records in an external data source. So, let's say I have Column A with a list of identity values. I want to develop Column B, which perhaps shows a count of rows in the table with that value. Something like: A B 758348 "=SELECT COUNT(*) FROM MYTABLE WHERE IDVALUE=$A$1" 173483 "=SELECT COUNT(*) FROM MYTABLE WHERE IDVALUE=$A$2" ... and so on. So, I thought I would use a parameterized query (where IDVALUE=?), but that prompts me

Excel macro to change external data query connections - e.g. point from one database to another

99封情书 提交于 2019-11-27 15:24:23
I'm looking for a macro/vbs to update all the external data query connections to point at a different server or database. This is a pain to do manually and in versions of Excel before 2007 it sometimes seems impossible to do manually. Anyone have a sample? I see there are different types of connections 'OLEDB' and 'ODBC', so I guess I need to deal with different formats of connection strings? I ended up writing the following, which prompts for the connection details, creates a connection string, then updates all external data queries to use that connection string. '''' Prompts for connection

Excel macro to change external data query connections - e.g. point from one database to another

☆樱花仙子☆ 提交于 2019-11-26 17:07:54
问题 I'm looking for a macro/vbs to update all the external data query connections to point at a different server or database. This is a pain to do manually and in versions of Excel before 2007 it sometimes seems impossible to do manually. Anyone have a sample? I see there are different types of connections 'OLEDB' and 'ODBC', so I guess I need to deal with different formats of connection strings? 回答1: I ended up writing the following, which prompts for the connection details, creates a connection