Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Intentionally not validate Sub or Function

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Intentionally not validate Sub or Function

I'm lost. RunTheSub is only executed if range "test" = "master". Otherwise ti
si not executed. Are you saying that there is no sub called RuntheSub so the
code will not compile but you would like to run it anyways?
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Intentionally not validate Sub or Function

Jim,

Yes. I need to copy multiple sheets (all the visible sheets) from one file
to a new file and preserve the names, references, etc.... The problem is
that there is code in the deactivate event on some of the pages.

I understand that the correct way to solve this problem is to move
everything off the page going through the workbook page by page and then
rename all the tabs accordingly. Seeing as I already have code that moves
everthing the way I want it except for when there is code in the deactivate
event, I thought maybe I could write something that would simply step over
the code that cause it to crash when it is in the new file.

I have also tried to move all the code to the page (not call a sub) and it
will compile. Problem in this case is that there is some hard-coded
passwords for unlocking. I could get away with that if I could
programmatically secure the new workbook. Any ideas???

Thanks in advance.





"Jim Thomlinson" wrote:

I'm lost. RunTheSub is only executed if range "test" = "master". Otherwise ti
si not executed. Are you saying that there is no sub called RuntheSub so the
code will not compile but you would like to run it anyways?
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Intentionally not validate Sub or Function

Having the password in the unprotected code module should be no more
problematic than depending on the password in the first place. If the
password works, then having it in the unprotected module should be equally
secure.

If it causes you concern, then build an algorithm to scramble and unscramble
the password so the visible password is a scrambled version of the password.

Certainly easier than the path you are headed down.

--
Regards,
Tom Ogilvy




"Troubled User" wrote:

Jim,

Yes. I need to copy multiple sheets (all the visible sheets) from one file
to a new file and preserve the names, references, etc.... The problem is
that there is code in the deactivate event on some of the pages.

I understand that the correct way to solve this problem is to move
everything off the page going through the workbook page by page and then
rename all the tabs accordingly. Seeing as I already have code that moves
everthing the way I want it except for when there is code in the deactivate
event, I thought maybe I could write something that would simply step over
the code that cause it to crash when it is in the new file.

I have also tried to move all the code to the page (not call a sub) and it
will compile. Problem in this case is that there is some hard-coded
passwords for unlocking. I could get away with that if I could
programmatically secure the new workbook. Any ideas???

Thanks in advance.





"Jim Thomlinson" wrote:

I'm lost. RunTheSub is only executed if range "test" = "master". Otherwise ti
si not executed. Are you saying that there is no sub called RuntheSub so the
code will not compile but you would like to run it anyways?
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Intentionally not validate Sub or Function

Thanks. Do you know how I can secure (Lock and Password Protect) the code in
the newly created sheet when I move the sheets? Thanks for your help.

"Tom Ogilvy" wrote:

Having the password in the unprotected code module should be no more
problematic than depending on the password in the first place. If the
password works, then having it in the unprotected module should be equally
secure.

If it causes you concern, then build an algorithm to scramble and unscramble
the password so the visible password is a scrambled version of the password.

Certainly easier than the path you are headed down.

--
Regards,
Tom Ogilvy




"Troubled User" wrote:

Jim,

Yes. I need to copy multiple sheets (all the visible sheets) from one file
to a new file and preserve the names, references, etc.... The problem is
that there is code in the deactivate event on some of the pages.

I understand that the correct way to solve this problem is to move
everything off the page going through the workbook page by page and then
rename all the tabs accordingly. Seeing as I already have code that moves
everthing the way I want it except for when there is code in the deactivate
event, I thought maybe I could write something that would simply step over
the code that cause it to crash when it is in the new file.

I have also tried to move all the code to the page (not call a sub) and it
will compile. Problem in this case is that there is some hard-coded
passwords for unlocking. I could get away with that if I could
programmatically secure the new workbook. Any ideas???

Thanks in advance.





"Jim Thomlinson" wrote:

I'm lost. RunTheSub is only executed if range "test" = "master". Otherwise ti
si not executed. Are you saying that there is no sub called RuntheSub so the
code will not compile but you would like to run it anyways?
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub

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
Code/Function to Look at Previous Entry to Validate Data Steve Excel Worksheet Functions 6 February 9th 09 07:06 AM
Intentionally truncating text characters Doug Excel Discussion (Misc queries) 2 June 22nd 07 12:22 AM
VALIDATE WB NAME AD108 Excel Programming 5 July 1st 06 05:55 AM
Can you use the validate function in a data form in Excel? Jolly Excel Worksheet Functions 0 December 12th 05 11:00 PM
Function to validate entries in a defined range Lee Wold[_2_] Excel Programming 4 December 31st 04 03:27 AM


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