- Aug 19, 2009
I have a userform that pulls the "captions" for it's 40 labels from cells on sheet 1 (A1 - A40). This is done at the time the userform is initiated. I want to be able to make this a permanent change to the userform so that when it is closed, the labels remain changed with the new captions so I can export the userform to other Office programs with the changes in place. I found a routine that supposedly does that, but I'm using Excel 2010 and it doesn't seem to do anything for me. The code is this:
How can I change this so that it works with 2010?
Dim cCntrl As Control Dim strName As String Dim iRow As Integer For Each cCntrl In Me.MultiPage1.Pages(0).Controls If TypeName(cCntrl) = "Label" Then iRow = iRow + 1 strName = Sheet1.Cells(1, 1) 'Sheet CodeName cCntrl.Caption = strName End If Next cCntrl