![]() |
Select values from spreadsheet and use as strings
Hello,
I currently have a number of strings which are declared as hard code in the macro for example dim folderloc as String folderloc = "C:\Development\filename.xls" I would like to look this up from a cell in the workbook. So that Sheet1 A1 would have the value C:\Development\filename.xls and this would be passed to my code How would I do this. Many Thanks Sean |
Select values from spreadsheet and use as strings
i am assuming you want to open the file
Workbooks.Open Filename:=Range("A1").Value, _ ReadOnly:=True, UpdateLinks:=3 -- Gary "sean_f" wrote in message oups.com... Hello, I currently have a number of strings which are declared as hard code in the macro for example dim folderloc as String folderloc = "C:\Development\filename.xls" I would like to look this up from a cell in the workbook. So that Sheet1 A1 would have the value C:\Development\filename.xls and this would be passed to my code How would I do this. Many Thanks Sean |
Select values from spreadsheet and use as strings
dim folderloc as string
folderloc=Worksheets("Sheet1").Range("A1").Value For better readability you could name ("FolderLocation") your range, in which case you could use: folderloc=Range("FolderLocation").Value HTH -- AP "sean_f" a écrit dans le message de oups.com... Hello, I currently have a number of strings which are declared as hard code in the macro for example dim folderloc as String folderloc = "C:\Development\filename.xls" I would like to look this up from a cell in the workbook. So that Sheet1 A1 would have the value C:\Development\filename.xls and this would be passed to my code How would I do this. Many Thanks Sean |
Select values from spreadsheet and use as strings
forgot to qualify the sheet
Workbooks.Open Filename:=Sheets("Sheet1").Range("A1").Value, _ ReadOnly:=True, UpdateLinks:=3 or this Dim fname As String fname = Sheets("sheet1").Range("a1") Workbooks.Open Filename:=fname, _ ReadOnly:=True, UpdateLinks:=3 -- Gary "sean_f" wrote in message oups.com... Hello, I currently have a number of strings which are declared as hard code in the macro for example dim folderloc as String folderloc = "C:\Development\filename.xls" I would like to look this up from a cell in the workbook. So that Sheet1 A1 would have the value C:\Development\filename.xls and this would be passed to my code How would I do this. Many Thanks Sean |
Select values from spreadsheet and use as strings
Many Thanks that works perfectly
|
Select values from spreadsheet and use as strings
Thanks,
I'll use that. sean |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com