ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   which page is active (https://www.excelbanter.com/excel-programming/343782-page-active.html)

JT

which page is active
 
How can I code an "if statement" to see which page in multipage form(4 pages)
has been selected? I want to do specific things if page4 is "active".
Thanks...
--
JT

Chip Pearson

which page is active
 
JT,

The Value property of the MultiPage control will return the index
number of the active tab. The index is zero-based, so the first
tab is Value = 0, the second page is Value = 1, etc. So you can
write code like

If Me.MultiPage1.Value = 3 Then
' fourth tab active
' do something
End If





--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"JT" wrote in message
...
How can I code an "if statement" to see which page in multipage
form(4 pages)
has been selected? I want to do specific things if page4 is
"active".
Thanks...
--
JT




Peter T

which page is active
 
All you need is the index of the current page from the multipage value
property

Private Sub CommandButton1_Click()
Dim n As Long
Dim s As String

n = Me.MultiPage1.Value
s = Me.MultiPage1.Pages(n).Caption

MsgBox "Index " & n, , s

End Sub

Don't forget the index of the first page (Page1) is 0

Regards,
Peter T

"JT" wrote in message
...
How can I code an "if statement" to see which page in multipage form(4

pages)
has been selected? I want to do specific things if page4 is "active".
Thanks...
--
JT




Dave Peterson

which page is active
 
Option Explicit
Private Sub MultiPage1_Change()
Me.CommandButton1.Enabled = Not CBool(Me.MultiPage1.Value = 3)
Me.CommandButton2.Enabled = Not CBool(Me.MultiPage1.Value = 3)
End Sub

Almost stolen from a response to your other post.

JT wrote:

How can I code an "if statement" to see which page in multipage form(4 pages)
has been selected? I want to do specific things if page4 is "active".
Thanks...
--
JT


--

Dave Peterson

JT

which page is active
 
Thanks for all of the help. I got it working now.... Thanks again
--
JT


"JT" wrote:

How can I code an "if statement" to see which page in multipage form(4 pages)
has been selected? I want to do specific things if page4 is "active".
Thanks...
--
JT



All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com