Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
accesing controls in for each loop
hi all!
when you are using something like: for each o in multipage1.pages(0).controls next o is the current control being 'looked' at out of the X number of controls on multipage1.pages(0) my question is - how do you access the previous control? ie so you could compare the contents of the previous text box with the present text box. tia! J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
accesing controls in for each loop
I suggest you don't use a For Each loop but a For i = x to y type instead:
Dim i As Integer With MultiPage1.Pages(0) 'Index value of 1st control is 0 and last control is .Controls.Count - 1 For i = 1 To .Controls.Count - 1 MsgBox .Controls(i).Text & vbCr & .Controls(i - 1).Text Next 'Alternate: 'For i = 2 To .Controls.Count 'MsgBox .Controls("TextBox" & i).Text & vbCr & .Controls("TextBox" & i - 1).Text 'Next End With Regards, Greg Wilson "Gixxer_J_97" wrote: hi all! when you are using something like: for each o in multipage1.pages(0).controls next o is the current control being 'looked' at out of the X number of controls on multipage1.pages(0) my question is - how do you access the previous control? ie so you could compare the contents of the previous text box with the present text box. tia! J |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to loop through controls on a MultiPage | Excel Programming | |||
Loop through objects/controls on worksheet | Excel Programming | |||
loop through controls | Excel Programming | |||
Accesing vba project from wb that has vba project password protected | Excel Programming | |||
Accesing a combobox control via it index propertie in VBA, Is itPossible? | Excel Programming |