Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Select values from spreadsheet and use as strings

Thanks,

I'll use that.

sean

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Select values from spreadsheet and use as strings

Many Thanks that works perfectly

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear all zero-length strings from spreadsheet? Matt D Francis Excel Discussion (Misc queries) 7 February 21st 07 04:33 PM
clear all zero-length strings from spreadsheet? Matt D Francis Excel Discussion (Misc queries) 0 February 21st 07 02:09 PM
clear all zero-length strings from spreadsheet? john Excel Discussion (Misc queries) 0 February 21st 07 01:58 PM
VB Assigning Values to a Series of Strings cincode5 Excel Discussion (Misc queries) 1 August 4th 05 11:38 PM
Convert values to strings Chris Excel Programming 2 May 10th 04 07:46 PM


All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"