Consulting

Results 1 to 4 of 4

Thread: Solved: Remove Module At Certain Criteria...

  1. #1

    Solved: Remove Module At Certain Criteria...

    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:

    [VBA]
    Sub QueryProcess()
    'set working directory to this workbook's folder and get file list
    *** IF CEll A61000 CONTAINS "EXPIRED..." THAN REMOVE ME ***
    If [COUNTA(D4100)] = 0 Then
    MsgBox "You Did Not Specify Any Search-Criteria..."
    Exit Sub
    End If
    Bea_ausfuellen
    FileSearchUF.Show
    STS
    End Sub
    [/VBA]
    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

  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Wolfgang

    Why not just add another if?
    [vba]
    If Range("A61000") = "Expired" Then Exit Sub
    [/vba]
    If you really want to remove the module check this Programming to the VBE.

  3. #3
    Hi Norie...

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

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

    Best,
    Wolfgang

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •