Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default require password each time a macro is executed

Workbook contains serveral worksheets with a number of macros. If the wrong
macro is executed for a given worksheet it will ruin the integrity of the
worksheet.
How do I avoid this problem other than using passwords.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default require password each time a macro is executed


Workbook contains serveral worksheets with a number of macros. If th
wrong
macro is executed for a given worksheet it will ruin the integrity o
the
worksheet.
How do I avoid this problem other than using passwords.

Hi Marty
If you know which macro should by run in which sheet, then code it s
it checks the sheet before running. Post back if you requir
help.........in coding this ... but give details

--
Ivan F Moal

-----------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...nfo&userid=195
View this thread: http://www.excelforum.com/showthread.php?threadid=26785

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default require password each time a macro is executed

Include a line in your code which checks that the required worksheet is
selected before the macro continues.

"Marty" wrote in message
...
Workbook contains serveral worksheets with a number of macros. If the

wrong
macro is executed for a given worksheet it will ruin the integrity of the
worksheet.
How do I avoid this problem other than using passwords.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default require password each time a macro is executed

Thanks Ivan,
I understand but is this an if statement and how do you write it?
Marty

"Ivan F Moala" wrote:


Workbook contains serveral worksheets with a number of macros. If the
wrong
macro is executed for a given worksheet it will ruin the integrity of
the
worksheet.
How do I avoid this problem other than using passwords.

Hi Marty
If you know which macro should by run in which sheet, then code it so
it checks the sheet before running. Post back if you require
help.........in coding this ... but give details.


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=267852


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default require password each time a macro is executed

Thanks Bigwheel,
I am rather new at this and understand your answere but have no idea how to
write it . Can you help?
Thanks again
Marty

"bigwheel" wrote:

Include a line in your code which checks that the required worksheet is
selected before the macro continues.

"Marty" wrote in message
...
Workbook contains serveral worksheets with a number of macros. If the

wrong
macro is executed for a given worksheet it will ruin the integrity of the
worksheet.
How do I avoid this problem other than using passwords.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default require password each time a macro is executed

If you can pick out something unique for that type of worksheet, then you can
test that to see if it's there.

For instance, if you have headers in A1:X1 and A1 always contains the text:
"Order Number"

you could put this at the top of your code:

sub testme()
if activesheet.range("a1").value < "Order Number" then
msgbox "Not on this sheet"
exit sub
end if
'your other code here
end sub

The question now becomes: Can you find something unique?


Marty wrote:

Thanks Bigwheel,
I am rather new at this and understand your answere but have no idea how to
write it . Can you help?
Thanks again
Marty

"bigwheel" wrote:

Include a line in your code which checks that the required worksheet is
selected before the macro continues.

"Marty" wrote in message
...
Workbook contains serveral worksheets with a number of macros. If the

wrong
macro is executed for a given worksheet it will ruin the integrity of the
worksheet.
How do I avoid this problem other than using passwords.





--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default require password each time a macro is executed

Sub Macro1()

if lcase(Activesheet.Name) < "sheet1" then
msgbox "Sheet2 must be active to run this macro"
exit sub
End if

' existing code that works on the active sheet.

End Sub

"Marty" wrote in message
...
Thanks Ivan,
I understand but is this an if statement and how do you write it?
Marty

"Ivan F Moala" wrote:


Workbook contains serveral worksheets with a number of macros. If the
wrong
macro is executed for a given worksheet it will ruin the integrity of
the
worksheet.
How do I avoid this problem other than using passwords.

Hi Marty
If you know which macro should by run in which sheet, then code it so
it checks the sheet before running. Post back if you require
help.........in coding this ... but give details.


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile:

http://www.excelforum.com/member.php...fo&userid=1954
View this thread:

http://www.excelforum.com/showthread...hreadid=267852




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
Macro get executed twice Anand Nichkaode Excel Discussion (Misc queries) 3 September 24th 08 01:25 PM
Require a macro for Excel 2007 pcor New Users to Excel 4 May 14th 08 01:34 AM
require macro or code for purchase order to do the following: jatman Excel Worksheet Functions 0 August 11th 06 06:02 AM
Parameter Query executed from a Macro David Excel Programming 4 April 19th 04 11:37 PM
Macro not executed Excel -- PowerPoint rick_deacha Excel Programming 0 February 24th 04 04:55 PM


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