title: Add multipage caption by looping from cell values
body: <p>I would like to generate the captions for the pages of an userform multipage by looping through some cell values, but unfortunately i get an error when the userform is initialized.</p>
  
  <pre><code>Private Sub UserForm_Initialize()
  
  Dim pagecount As Integer
  Dim n As Integer
  Dim name As Integer
  
  pagecount = Sheets("SETUP").Range("B" &amp; rows.Count).End(xlUp).Row - 5
  n = 0
  name = 6
  
  With MultiPage1
  Do
  .Pages(n).Caption = Sheets("SETUP").Range("B" &amp; name).Value
  n = n + 1
  name = name + 1
  Loop Until n = pagecount
  End With
  
  End Sub
  </code></pre>