Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Replacing hard code with reference to a cell value

Hello,

Currently I am using the following line of code to specify the location of
my database.

MyConn = "S:\Mydatabase.mdb"

Instead of hard coding the location of my database, I would like to enter
the location in Cell A1 in Sheet2. How do I change this line of code so it
would read the location of my database from whatever I type into cell A1 in
Sheet2?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Replacing hard code with reference to a cell value

myConn = activeworkbook.worksheets("sheet2").range("a1").va lue

Activeworkbook
could be
ThisWorkbook
if the that worksheet is in the same workbook with the code.

Or even
workbooks("myotherworkbook.xls").worksheets("sheet 2").range("a1").value



jojo wrote:

Hello,

Currently I am using the following line of code to specify the location of
my database.

MyConn = "S:\Mydatabase.mdb"

Instead of hard coding the location of my database, I would like to enter
the location in Cell A1 in Sheet2. How do I change this line of code so it
would read the location of my database from whatever I type into cell A1 in
Sheet2?

Thanks!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Replacing hard code with reference to a cell value

thank you!

"Dave Peterson" wrote:

myConn = activeworkbook.worksheets("sheet2").range("a1").va lue

Activeworkbook
could be
ThisWorkbook
if the that worksheet is in the same workbook with the code.

Or even
workbooks("myotherworkbook.xls").worksheets("sheet 2").range("a1").value



jojo wrote:

Hello,

Currently I am using the following line of code to specify the location of
my database.

MyConn = "S:\Mydatabase.mdb"

Instead of hard coding the location of my database, I would like to enter
the location in Cell A1 in Sheet2. How do I change this line of code so it
would read the location of my database from whatever I type into cell A1 in
Sheet2?

Thanks!


--

Dave Peterson

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
Replacing hard returns in long text strings. Geoff C Excel Discussion (Misc queries) 3 November 20th 08 10:43 AM
Replacing cell reference on multiple sheets in one go.... neilcarden Excel Worksheet Functions 3 August 6th 08 11:20 AM
Replacing a hard line break in Excel a_ryan1972 Excel Discussion (Misc queries) 4 October 25th 06 09:28 PM
Hard Code DLL Reference in VBA alex Excel Programming 4 June 10th 04 05:05 PM
Hard Code DLL Reference in VBA alex Excel Programming 0 June 10th 04 01:20 PM


All times are GMT +1. The time now is 06:35 AM.

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

About Us

"It's about Microsoft Excel"