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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
frmAudit.MultiPage1.Pages(x-1).Caption = ActiveCell.Offset(x, 0)

(x-1) is because the first page is 0, not 1.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,619
Members
449,238
Latest member
wcbyers

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