ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find data another workbook (https://www.excelbanter.com/excel-programming/391949-find-data-another-workbook.html)

Trever B

find data another workbook
 
Hi

Thanks in advance Don't know to reference another workbook with folder and
file name.

Looking at the following code I am unsure how to get information from other
spreadsheets.

In the loop the folder will look at various stores. The following shows
perth but does not look at it. I have 10 other stores to look at.

How do I reference another workwook.


Dim strLookSheet As String
Dim varAnswer As Variant
Dim strWorkbookFolder As String
Dim strWorkbookFile As String

strWorkbookSheet = "Meats"
strWorkbookFolder = "C:\data\perthstore\"
strWorkbookFile = "Today_Sales"

varAnswer = Worksheets(strWorkbookSheet).Range("D6").Value





thanks for all your help.

Trev B

joel

find data another workbook
 
strWorkbookSheet = "Meats"
strWorkbookFolder = "C:\data\perthstore\"
strWorkbookFile = "Today_Sales"

Workbooks.Open Filename:= _
strWorkbookFolder & strWorkbookFile

Windows(strWorkbookFile).Activate
varAnswer = Worksheets(strWorkbookSheet).Range("D6").Value


"Trever B" wrote:

Hi

Thanks in advance Don't know to reference another workbook with folder and
file name.

Looking at the following code I am unsure how to get information from other
spreadsheets.

In the loop the folder will look at various stores. The following shows
perth but does not look at it. I have 10 other stores to look at.

How do I reference another workwook.


Dim strLookSheet As String
Dim varAnswer As Variant
Dim strWorkbookFolder As String
Dim strWorkbookFile As String

strWorkbookSheet = "Meats"
strWorkbookFolder = "C:\data\perthstore\"
strWorkbookFile = "Today_Sales"

varAnswer = Worksheets(strWorkbookSheet).Range("D6").Value





thanks for all your help.

Trev B



All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com