SourceRange Property

Microsoft Excel Visual Basic

Returns a Range object that represents the cell that contains the value of the specified query parameter. Read-only.

Example

This example changes the value of the cell used as the source range for the query.

Set qt = Sheets("sheet1").QueryTables(1)
Set param1 = qt.Parameters(1)
Set r = param1.SourceRange
r.Value = "New York"
qt.Refresh