Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code/Function to Look at Previous Entry to Validate Data | Excel Worksheet Functions | |||
Intentionally truncating text characters | Excel Discussion (Misc queries) | |||
VALIDATE WB NAME | Excel Programming | |||
Can you use the validate function in a data form in Excel? | Excel Worksheet Functions | |||
Function to validate entries in a defined range | Excel Programming |