PDA

View Full Version : Solved: Remove Module At Certain Criteria...



Wolfgang
08-23-2006, 07:43 AM
Good Morning/Evening to you...

Is it possible to remove a module from the current workbook if a certain condition is met?!

Here's the module:


Sub QueryProcess()
'set working directory to this workbook's folder and get file list
*** IF CEll A61000 CONTAINS "EXPIRED..." THAN REMOVE ME ***
If [COUNTA(D4:D100)] = 0 Then
MsgBox "You Did Not Specify Any Search-Criteria..."
Exit Sub
End If
Bea_ausfuellen
FileSearchUF.Show
STS
End Sub

I like to have that module be removed so that the user will not be able to use that routine anymore...

Thank you and best regards,

Wolfgang

Norie
08-23-2006, 08:49 AM
Wolfgang

Why not just add another if?

If Range("A61000") = "Expired" Then Exit Sub

If you really want to remove the module check this Programming to the VBE (http://www.cpearson.com/excel/vbe.htm).

Wolfgang
08-23-2006, 09:03 AM
Hi Norie...

I used Chip's example and it works just fine...

Thank you very much and have a nice evening...

Best,
Wolfgang

mdmackillop
08-23-2006, 09:58 AM
Hi Wolfgang,
If this is solved, please mark it so using thread tools. Also, when you post code, Please select it and click the VBA button to format it for easy reading. (as shown)
Regards
MD