我想用它来执行SQL服务器中的一些操作。如何创建一个VBA代码(对于循环,更准确)来获得一个类似于:
的字符串 sql = "select @Name = 'BookA', @price = col next to BookA where date in col D = cell("D1");
select @Name = 'BookB', @price = col next to BookB where date in col F = cell("D1");..."
例如假设单元格中的日期(“D1”)= '01 .10.2015'
sql
应该等于
"select @Name = 'BookA', @price = 101.651; select @Name = 'BookB', @price = 96.291; and so on"
答案 0 :(得分:1)
将此程序放在标准代码模块中:
{{1}}