![]() |
workbooks.open
I would like to open 4 files with a macro. If I just open one file it works.
If I try to open more than one, I get a subscript out of range error. Can you help me with this? Thanks! Workbooks.Open Sheets("files").Range("C3").Value Workbooks.Open Sheets("files").Range("C4").Value |
workbooks.open
After the first workbooks.open, the opened workbook is the active
workbook, so your reference to Sheets("files").Range(..) is invalid unless the just opened workbook has a worksheet named "files". Try: With ThisWorkbook.Sheets("files") Workbooks.Open .Range("C3").Value Workbooks.Open .Range("C4").Value End With In article , Jim Cottrell wrote: I would like to open 4 files with a macro. If I just open one file it works. If I try to open more than one, I get a subscript out of range error. Can you help me with this? Thanks! Workbooks.Open Sheets("files").Range("C3").Value Workbooks.Open Sheets("files").Range("C4").Value |
workbooks.open
That worked perfectly!
Thanks so much! "JE McGimpsey" wrote: After the first workbooks.open, the opened workbook is the active workbook, so your reference to Sheets("files").Range(..) is invalid unless the just opened workbook has a worksheet named "files". Try: With ThisWorkbook.Sheets("files") Workbooks.Open .Range("C3").Value Workbooks.Open .Range("C4").Value End With In article , Jim Cottrell wrote: I would like to open 4 files with a macro. If I just open one file it works. If I try to open more than one, I get a subscript out of range error. Can you help me with this? Thanks! Workbooks.Open Sheets("files").Range("C3").Value Workbooks.Open Sheets("files").Range("C4").Value |
All times are GMT +1. The time now is 03:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com