Cycling through textboxes in a tab of a MultiPage control

craigyg

Board Regular
Joined
Dec 14, 2005
Messages
114
I have been using the following code for cycling through textboxes on a userform and dumping their values onto a temp worksheet:

i = 1
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
ThisWorkbook.Sheets("Temp Values").Cells(i, 1) = ctl.Value
i = i + 1
End If
Next ctl

I need to modify it now to just dump values for one tab within a multipage control on a userform (I have a multipage control with 9 tabs or so and 10 or so textboxes per tab). It should not dump values for any other tab than the one that I will specify in the code. How can I modify the For Each statement to tell the code to just look on the tab. Or is there another way to do this? Thanks.

- Craig
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You can specify the page upon which to look for controls.
Don't format the pages index is zero based.

Code:
    i = 1
    For Each ctl In MultiPage1.Pages(2).Controls
        If TypeName(ctl) = "TextBox" Then
            ThisWorkbook.Sheets("Temp Values").Cells(i, 1) = ctl.Value
            i = i + 1
        End If
    Next ctl
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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