Reputation: 313
I'm curious about what the format of a code in VBA for...
obtaining specific rows from a specific sheet from a specific workbook within a specific subset of folders.
for example: Populating Sheet1 in Wkbk1 from the data in Sheet1 from Wkbk2 which is in a shared drive somewhere....
Any ideas?
EDIT:
I realize this may be a vague post so I am going to try to explain in further detail.
I am looking for a code which allows me to do the following.
Upvotes: 0
Views: 4483
Reputation: 27259
This code below can be made more exact or efficient, but it will get you started:
Option Explicit
Sub PullFromFile()
Dim wkb as Workbook, wkbFrom as Workbook
Set wkb = ThisWorkbook '-> assuming the workbook you want to copy to has code in it
Set wkbFrom = Workbooks.Open("S:\Me\letsshare\thisfile.xlsx")
Dim wks as Worksheet
Set wks = wkbFrom.Sheets("mySpecificSheet")
Dim rng as Range
Set rng = wks.Rows("1:3") '-> set your specific rows, here
rng.Copy wkb.Sheets("whichSheet").Range("A1") '-> adjust to your settings
wkbFrom.Close False
End Sub
Upvotes: 1