Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm fairly new to VB and need to create a macro which will open another workbook and more specifically a sheet within it depending on its contents. I'll try to be a bit clearer. Say cell "A1" contained the name of the sheet in another workbook, can I get a macro to read the contents of "A1" and open that specific sheet? As I said I'm fairly new to this, so the actual code to do it would excellent. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The macro recorder is your friend. I just recorded this and then modified.
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 5/2/2006 by Don Guillett ' ' 'Workbooks.Open Filename:="C:\yourfolder\yourfilename.xls" Workbooks.Open Filename:="C:\yourfolder\" & Range("a1") & ".xls" End Sub -- Don Guillett SalesAid Software "monkey harry" wrote in message oups.com... Hi, I'm fairly new to VB and need to create a macro which will open another workbook and more specifically a sheet within it depending on its contents. I'll try to be a bit clearer. Say cell "A1" contained the name of the sheet in another workbook, can I get a macro to read the contents of "A1" and open that specific sheet? As I said I'm fairly new to this, so the actual code to do it would excellent. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
supposing that cell A1 contains path and filename (like "c:\test.xls"). you can use this code sub OpenFile() workbooks.open(range("a1").value) end sub To open the file "test.xls" This is just basic code without error trapping. Regards, Ivan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks
That's helped a lot!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I insert a picture depending on the contents of another cell? | Excel Discussion (Misc queries) | |||
Copy cell contents depending on font colour | Excel Worksheet Functions | |||
Rename active sheet to contents of specific cell | Excel Programming | |||
Change the colour of a row depending on the contents of a date cell | Excel Programming | |||
How do I change a buttons contents depending on a cells contents? | Excel Programming |