[英]Excel VBA - how to display the SQL results on a specific cell?
With ActiveSheet.QueryTables.Add(Connection:.., Destination:=Range("A1"))
so instead the sql results will display starting in A1 , i would like to specify it depending on what the value inside the cell B1 for example 所以取而代之的是,sql结果将从A1开始显示,我想根据单元格B1中的值来指定它,例如
i tried this: 我尝试了这个:
With ActiveSheet.QueryTables.Add(Connection:..,Destination:=Range("A1").value)
but its not working. 但它不起作用。
That's because Range("A1").value
is returning a String
containing "B1" instead of a Range
object representing the B1 position. 这是因为Range("A1").value
返回的是包含“ B1”的String
,而不是表示B1位置的Range
对象。
Try this instead: ActiveSheet.QueryTables.Add(Connection:..,Destination:=Range(Range("A1").value))
请尝试以下方法: ActiveSheet.QueryTables.Add(Connection:..,Destination:=Range(Range("A1").value))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.