Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49948

[SOLVED] Change file path name in VBA code based on files location

$
0
0
Hi all,
I have the following code written but I'm wondering if it's possible to modify this to change the red line to update to the path that the workbook is saved in? Meaning that User1\Folder1\ would change but [Workbook1.xlsm]Sheet1'E1 would always be the same. Thanks for any help you can give!


Code:

Private Sub CommandButton1_Click()
' Partner Name
      With Sheets("Data Input").Range("C3")
        .Formula = "='\\PC-SERVER\User1\Folder1\[Workbook1.xlsm]Sheet1'! E1"
          .Value = .Value
      End With
End Sub


Viewing all articles
Browse latest Browse all 49948

Trending Articles