If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Open multiple spreadsheets and pull data
I'm writing an update routine that keeps 2 EXCEL 2010 spreadsheets in-sync.
I'm using this code to open the first spreadsheet and read data into variable: Workbooks.Open ("\\server\share\Spreadsheet1.xlsx") set rgePROGRESS = Worksheets("xxxx").Range("A2:C341") (code works fine) Then I read local (or try to read) spreadsheet: Dim AddressSheet As Worksheet Set AddressSheet = Worksheets("Dups") FinalRow = AddressSheet.Cells(65536, 2).End(xlUp).Row Set rgeDUPS = Worksheets("Dups").Range("A2:I" & FinalRow) (code works fine) The following code fails by trying to write into a worksheet called "Dups" on the network spreadsheet: For i = 1 To rgeDUPS.Rows.Count wellno = rgeDUPS.Cells(i, 3).Value For k = 1 To rgePROGRESS.Rows.Count If rgePROGRESS.Cells(k, 1).Value = wellno Then Worksheets("Dups").Cells(i, 8).Value = rgePROGRESS.Cells(k, 3).Value End If Next k Next i Thanks for any help . . . |
Thread Tools | |
Display Modes | |
|
|