Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default User Indicating the Arguments while code is running

Hi,

1. I have a macro in workbook A with which I activate an already open
workbook called workbook B using

Windows("B.xls").Activate

Problem is Name of the workbook B may change with time or somebody might
change it inadvertently so please guide me on how to take care of the same.
(Actually somebody else will be using/working on this code/workbook and I
wanted to make it robust so that they are not held up due to changed names
etc.)

Is it possible for the user to somehow indicate the workbook while running
the code or rather even better would it be possible that only when the code
gets hung due to name of the workbook being changed user is prompted for
actual workbook name.

2. Also the above code runs in a worksheet called "Raw Data" and similar to
aboev situation it might happen that the name of the worksheet is changed.
Hence would it be possible for the user to be prompted with the correct name
of the worksheet when code execution fails at that point.

3. A query - when we write formulas in excel cells by linking them to other
worksheets cells then when the name of the other worksheet is changed the
formula also gets updated automatically with the new name. Now, if I have
code in which I refer to worksheets then it becomes a problem as I have to
use Ctrl+H to replace with the new names. Is there a more efficient solution
or do I have to live with that?

Regards,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default User Indicating the Arguments while code is running

Hi
1. You could use inputbox to ask the user for information

2. use activesheet for referencing the current worksheet

3. Formulas do this automatically. Just test it :-)

--
Regards
Frank Kabel
Frankfurt, Germany

"Hari" schrieb im Newsbeitrag
...
Hi,

1. I have a macro in workbook A with which I activate an already open
workbook called workbook B using

Windows("B.xls").Activate

Problem is Name of the workbook B may change with time or somebody

might
change it inadvertently so please guide me on how to take care of the

same.
(Actually somebody else will be using/working on this code/workbook

and I
wanted to make it robust so that they are not held up due to changed

names
etc.)

Is it possible for the user to somehow indicate the workbook while

running
the code or rather even better would it be possible that only when

the code
gets hung due to name of the workbook being changed user is prompted

for
actual workbook name.

2. Also the above code runs in a worksheet called "Raw Data" and

similar to
aboev situation it might happen that the name of the worksheet is

changed.
Hence would it be possible for the user to be prompted with the

correct name
of the worksheet when code execution fails at that point.

3. A query - when we write formulas in excel cells by linking them to

other
worksheets cells then when the name of the other worksheet is changed

the
formula also gets updated automatically with the new name. Now, if I

have
code in which I refer to worksheets then it becomes a problem as I

have to
use Ctrl+H to replace with the new names. Is there a more efficient

solution
or do I have to live with that?

Regards,
Hari
India



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default User Indicating the Arguments while code is running

Interesting Question, I wonder if there is a better way than mine?

The way I currently handle changing of workbook names is in
ThisWorkBook.Workbook_SheetCalculate(ByVal Sh As Object)

Only downside is that application.Calculation must be on for this to work.

Claus



"Hari" wrote in message
...
Hi,

1. I have a macro in workbook A with which I activate an already open
workbook called workbook B using

Windows("B.xls").Activate

Problem is Name of the workbook B may change with time or somebody might
change it inadvertently so please guide me on how to take care of the

same.
(Actually somebody else will be using/working on this code/workbook and I
wanted to make it robust so that they are not held up due to changed names
etc.)

Is it possible for the user to somehow indicate the workbook while running
the code or rather even better would it be possible that only when the

code
gets hung due to name of the workbook being changed user is prompted for
actual workbook name.

2. Also the above code runs in a worksheet called "Raw Data" and similar

to
aboev situation it might happen that the name of the worksheet is changed.
Hence would it be possible for the user to be prompted with the correct

name
of the worksheet when code execution fails at that point.

3. A query - when we write formulas in excel cells by linking them to

other
worksheets cells then when the name of the other worksheet is changed the
formula also gets updated automatically with the new name. Now, if I have
code in which I refer to worksheets then it becomes a problem as I have to
use Ctrl+H to replace with the new names. Is there a more efficient

solution
or do I have to live with that?

Regards,
Hari
India




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
Running XY chart labeller using a macro's parameters and arguments. Hari Prasadh Charts and Charting in Excel 1 July 12th 05 05:00 PM
Shortcut way for indicating comments in block of code. Hari[_3_] Excel Programming 5 August 10th 04 01:49 AM
Excel user-defined Function: definition/help of arguments fmoi1 Excel Programming 1 July 16th 04 03:23 PM
GetSaveAsFilename - how to code the arguments L Mehl Excel Programming 3 February 24th 04 06:55 PM
Problems running a sub having arguments Stuart[_5_] Excel Programming 5 October 17th 03 05:41 AM


All times are GMT +1. The time now is 10:18 AM.

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"