Search code examples
vbaexcelnamed-ranges

VBA Excel MACRO-Destination:=RANGE Active Cell instead of "Named" Range


Simply needing to point (RANGE) to the active cell in active worksheet. Destination:=Range("$A$1") needs to read "Activecell", somehow. I can't seem to get it to work. Thanks for any assistance!

Sub DestinationCell
   With ActiveSheet.QueryTables.Add(Connection:= _
    "TEXT;\\mpls.ucare.pvt\\PB 67311 FS.csv" _
    , Destination:=Range("$A$1"))    
End sub

Solution

  • You mean you want the origin cell of the QueryTable to be where ever the active cell is?

    Sub DestinationCell()
       With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;\\mpls.ucare.pvt\\PB 67311 FS.csv" _
        , Destination:=Application.ActiveCell)
    End Sub