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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

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.
 
Upvote 0

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
 
Upvote 0

Forum statistics

Threads
1,187,189
Messages
5,962,116
Members
438,586
Latest member
flickalok

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