Don't run script when active page is clicked

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
If the active page is page3 or page5, then don't say hello when it's clicked.

It's giving me a headache. Can someone fix that for me?

Code:
Private Sub MultiPage1_Click (ByVal Index As Long )
With MultiPage1
Select Case .Value 
    Case 2, 4 : MsgBox "Hello"
End Select 
End With
End Sub
 
Code:
Private Sub MultiPage1_Click(ByVal Index As Long)
    Static LastPage As Long
    If MultiPage1.Value = 2 Then
        If LastPage <> 2 Then MsgBox "hi"
    ElseIf MultiPage1.Value = 4 then
        If LastPage <> 4 Then MsgBox "hi"
    End If
    LastPage = MultiPage1.Value
End Sub

Sure, this is also cute.

Regards
Kelly
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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