Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Executing Macro Help

Hi,

For example, I'm in Profits worksheet and choose best scenario from
the combo box, and it changes B92 in Rev tab. Also, is there a way to
keep focus on the worksheet and have it still execute the macro?


I assume your macro was recorded and uses things like :

Range("A1").DoSomething

If you want to do this on just one worksheet, surround your entire code
(inside a sub) with:

With Worksheets("YourSheet")
'Your code
End With

Now for each "Range" make sure you prepend it with a dot:

.Range(.......

This way your code now talks to ranges on "YourSheet".

To make sure that worksheet is visible, add:

.Activate

anywhere within the with...end with construction.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

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
executing a macro within another brian Excel Discussion (Misc queries) 3 July 5th 06 01:22 AM
Preventing macro from .xlt from executing in a .xls XxLicherxX Excel Programming 0 November 18th 05 06:34 PM
Executing a macro from a cell filo666 Excel Discussion (Misc queries) 2 February 15th 05 08:18 PM
What macro is executing? Ken Loomis Excel Programming 3 October 13th 04 05:39 AM
How to abort executing macro? perfb Excel Programming 1 June 16th 04 07:15 PM


All times are GMT +1. The time now is 04:29 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"