I have a user form with 12 frames, each representing a "row." The user form gets the total number of rows (a number between 1 and 12). Each frame is named "Row?Frame", where the question mark is a number between 1 and 12. The user form is named DefineRowsUserForm. I want to hide all the rows that are not needed. For example, to hide row 3:

DefineRowsUserForm.Row3Frame


I want to automate this to hide the uneeded rows based on the total number of rows. I tried to do this as follows:

Dim RowEraseLabel As String
'Get the number of rows
NumRows = Val(ConnUserForm.NumPinsTextBox.Value)
'Hide unnecessary rows
For i = NumRows + 1 To 12 Step 1 'count over pins in each row
RowEraseLabel = "DefineRowsUserForm.Row" & i & "Frame"
RowEraseLabel.Visible = False
Next i

The above code does not work, but only shows the idea of what I want to do. If anyone knows a slick way to do this, please help.