All,
First time poster and VBA novice. I am trying to have VBA open a file on a shared drive where the file path can change. Therefore, I would like VBA to use the file path specified in cell A1 on "Report" tab. I can get the results by embedding the file path in the code, but this is not efficient as there are numerous files that will need to be opened and the change monthly. I am working in Excel 2013. Any help would be great! Here is what I have thus far:
Option Explicit
Sub PullFromFile()
Dim wkb As Workbook, wkbFrom As Workbook
Set wkb = ThisWorkbook
Set wkbFrom = Workbooks.Open("H:\027-12 2015 Checkbook.xls")
Dim wks As Worksheet
Set wks = wkbFrom.Sheets("RBM")
Dim rng As Range
Set rng = wks.Rows("1:10000")
rng.Copy wkb.Sheets("Sheet1").Range("A1") '
wkbFrom.Close False
End Sub
First time poster and VBA novice. I am trying to have VBA open a file on a shared drive where the file path can change. Therefore, I would like VBA to use the file path specified in cell A1 on "Report" tab. I can get the results by embedding the file path in the code, but this is not efficient as there are numerous files that will need to be opened and the change monthly. I am working in Excel 2013. Any help would be great! Here is what I have thus far:
Option Explicit
Sub PullFromFile()
Dim wkb As Workbook, wkbFrom As Workbook
Set wkb = ThisWorkbook
Set wkbFrom = Workbooks.Open("H:\027-12 2015 Checkbook.xls")
Dim wks As Worksheet
Set wks = wkbFrom.Sheets("RBM")
Dim rng As Range
Set rng = wks.Rows("1:10000")
rng.Copy wkb.Sheets("Sheet1").Range("A1") '
wkbFrom.Close False
End Sub