ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting data from one spreadsheet to another (https://www.excelbanter.com/excel-programming/276529-getting-data-one-spreadsheet-another.html)

Don Fuller

Getting data from one spreadsheet to another
 
I have created a VB function that will pull numerical data from
specific cells in different spreadsheets and place the data in my main
status spreadsheet. Everything works fine, but I am getting data from
my status spreadsheet instead of the spreadsheets on the server.
Basically, I am pulling that data from the local source instead of the
remote sources. Below is the portion of my function that is not
working properly.

If Cells(TestCaseRow, 1) = "a" Then ColumnA = ColumnA +
Cells(TestCaseRow, 20)
If Cells(TestCaseRow, 1) = "b" Then ColumnB = ColumnB +
Cells(TestCaseRow, 20)
If Cells(TestCaseRow, 1) = "c" Then ColumnC = ColumnC +
Cells(TestCaseRow, 20)

I need to get the path to the remote spreadsheets into the statements
above. Any help will be greatly appreciated.

Don

Dick Kusleika

Getting data from one spreadsheet to another
 
Don

When you use the Cells property unqualified, it's the same as using

ActiveSheet.Cells(...

You need to create an object variable that points to the sheet that you
want, then qualify all your Cells properties with that variable.

Dim sh As Worksheet

Set sh = Workbooks("Book1.xls").Worksheets(1)

If sh.Cells(TestCaseRow etc...

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Don Fuller" wrote in message
om...
I have created a VB function that will pull numerical data from
specific cells in different spreadsheets and place the data in my main
status spreadsheet. Everything works fine, but I am getting data from
my status spreadsheet instead of the spreadsheets on the server.
Basically, I am pulling that data from the local source instead of the
remote sources. Below is the portion of my function that is not
working properly.

If Cells(TestCaseRow, 1) = "a" Then ColumnA = ColumnA +
Cells(TestCaseRow, 20)
If Cells(TestCaseRow, 1) = "b" Then ColumnB = ColumnB +
Cells(TestCaseRow, 20)
If Cells(TestCaseRow, 1) = "c" Then ColumnC = ColumnC +
Cells(TestCaseRow, 20)

I need to get the path to the remote spreadsheets into the statements
above. Any help will be greatly appreciated.

Don





All times are GMT +1. The time now is 08:29 AM.

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