You'll want to declare oUserform
as an instance of frmbusinessimpact
and use the New
keyword.
Public oUserform As frmbusinessimpact
Public iNumberOfRecords As Integer
Public iEndRow As Integer
Sub subIntialize()
Set oUserform = New frmbusinessimpact
iEndRow = Sheet1.Cells(1, 1).CurrentRegion.Rows.Count
iNumberOfRecords = iEndRow - 1
Call subPopulateRecordClass(iEndRow)
With oUserform
.TotalRecords = iNumberOfRecords
.CurrentRecord = 1
Call subUpdateUserform
End With
oUserform.Show
End Sub
The book Professional Excel Development has a good chapter on how, and why, to code userforms this way. I've got a more specific example at http://yoursumbuddy.com/a-flexible-vba-chooser-form/.