VBA - Case study whether a subroutine is active or not.

prinzip

New Member
Joined
Feb 7, 2012
Messages
34
Hello, I started using VBA recently and I have a question. I am using the case study shown below in a UserForm.

Code:
        Case 0: Call ActivateHDB
        Case 1: Call ActivateHDT
        Case 2: Call ActivateLD4C
        Case 3: Call ActivateLD4T
        Case 4: Call ActivateM4
        Case 5: Call ActivateLD2
Through a different subroutine named ActivateGAS (shown below) and called after the above select case option, i want to perform an If...else If case structure ( I think that is the most appropriate). Maybe its a stupid question, but I don't know how to find out whether a subroutine is active or not.

Code:
Sub ActivateGAS()

    With wb1
        Selection.Rows(5).Select
    End With
    
    With wb2
    
        If IsActivated.ActivateLD4C Then
        Selection.Rows("1:7").Select
        ElseIf IsActivated.ActivateLD4T Then
        Selection.Rows("1:7").Select
        Else
        Selection.Rows("1:4").Select
        End If
        
    End With
    
End Sub
The IsActivated command its just something i made up my mind to show what I'm looking for.
 
The only time it would be required is if the UserForm module became too large. You can access the control on a UserForm in a General module if you qualify it with the name of the UserForm, eg:

Rich (BB code):
Select Case UserForm1.ComboBox2.ListIndex
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top