Multipage control on Userform

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
cmdU1PA is an activex Button from controls toolbar, located on a worksheet.
cmdU1PA click event code:

Private Sub cmdU1PA_Click()

Application.ScreenUpdating = False

Range("U1P").Activate

For x = 1 To 7
frmAudit.MultiPage1.Page1.Caption = ActiveCell.Offset(x, 0)
Next x

Application.ScreenUpdating = True

frmAudit.Show

End Sub

MultiPage1 is on the Userform "frmAudit"
MultiPage1 has 7 pages Page1...Page7
The code above loops thru the 7 cells below the active cell named U1P.
Is there a way to get
frmAudit.MultiPage1.Page1.Caption = ActiveCell.Offset(x, 0)
to loop thru the pages 1 to 7, i.e. pageX ??


Thanks,
Chas
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

CraigM

Active Member
Joined
Feb 27, 2003
Messages
320
frmAudit.MultiPage1.Pages(x-1).Caption = ActiveCell.Offset(x, 0)

(x-1) is because the first page is 0, not 1.
 

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
Thanks, I brain dumped the starts at 0. Thanks again

the loop works great now, sure beats

frmAudit.MultiPage1.Page1.Caption = ActiveCell.Offset(1, 0)
frmAudit.MultiPage1.Page2.Caption = ActiveCell.Offset(2, 0)
frmAudit.MultiPage1.Page3.Caption = ActiveCell.Offset(3, 0)
frmAudit.MultiPage1.Page4.Caption = ActiveCell.Offset(4, 0)
frmAudit.MultiPage1.Page5.Caption = ActiveCell.Offset(5, 0)
frmAudit.MultiPage1.Page6.Caption = ActiveCell.Offset(6, 0)
frmAudit.MultiPage1.Page7.Caption = ActiveCell.Offset(7, 0)

thanks Craig,
Chas
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,327
Messages
5,769,460
Members
425,550
Latest member
Bonebeast

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
Top