Reference another workbook with dynamic worksheet name

前端 未结 2 778
野性不改
野性不改 2021-01-27 03:36

I want to reference another workbook and a specific worksheet which is dependent on some cell values.

This equation works

=\'S:\\Down Time[11-Nov_2013_Downtime T

2条回答
  •  无人共我
    2021-01-27 04:08

    A little bit late, but here it goes in case someone else is looking for it. Change the ranges to accommodate your needs.

    With VBA:

    Sub CallOtherWB()
    
        Dim ThisMonth As String
        Dim TheOtherVar As String
    
        ThisMonth = Range("D13").Value
        TheOtherVar  = Range("E13").Value
    
        With Range("A1")
            .Formula = "'S:\Down Time[11-" & ThisMonth & "_2013_Downtime Tracker.xls]" & TheOtherVar  & "'!$F$12"
        End With
    
    End Sub
    

提交回复
热议问题