View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default how can I ..... ?

Emma,

The following will call ChDir to use whatever is in A1:

ChDir ActiveSheet.Range("A1").Text

You can also use a variable to do this. E.g.,

Dim S As String
S = "\\SharedDocs\Test01 "
ChDir S


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"emma" wrote in message
...
I have in Sheet1 in A1 the following

= "\\SharedDocs\Test01"
in A2 = "\\SharedDocs\Test02"

How can I in the code assign a variable to chage to that
directory

Now what I have to change the directory is:
ChDir "\\SharedDocs\Test01 "

but I want to have something like that :

ChDir "variable" (what it is in A1 for example)

thanks a lot
emma