Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Check active sheet not the one with macros

I have a workbook with macros that are used to process the
contents of other workbooks.

I need a test to ensure that when i run the macros the
active sheet belongs to a workbook other than the one with
the macros.

I don't know how. Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Check active sheet not the one with macros

Got It!

If ActiveWorkbook.Name = ThisWorkbook.Name Then
MsgBox "The source worksheet is not active. Bring
the source worksheet to the front and try again."
Exit Sub
End If


-----Original Message-----
I have a workbook with macros that are used to process

the
contents of other workbooks.

I need a test to ensure that when i run the macros the
active sheet belongs to a workbook other than the one

with
the macros.

I don't know how. Any suggestions?
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Check active sheet not the one with macros

You could try the following:
Set a variable to the name of the workbook with the macros

MacroWkbkNm = ActiveWorkbook.Name 'Run when macro book is
active or set to something like "My Macro.xls"

Then, when you are testing whether the active sheet is in
the same workbook, you could only run code in another
workbook by using:

If ActiveWorkbook.Name < MacroWkbkNm Then
'Run code here
End If

-----Original Message-----
I have a workbook with macros that are used to process

the
contents of other workbooks.

I need a test to ensure that when i run the macros the
active sheet belongs to a workbook other than the one

with
the macros.

I don't know how. Any suggestions?
.

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
to change the macros as per active cell and range pol Excel Discussion (Misc queries) 2 August 4th 09 01:19 PM
Active Content/Macros Canon Excel Discussion (Misc queries) 2 June 4th 09 12:57 PM
how to list all active macros and their assigned keystrokes? z.entropic Excel Worksheet Functions 2 October 5th 07 03:29 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
Code to check for active worksheet KimberlyC Excel Programming 2 November 5th 03 02:49 AM


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