ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamically Hiding portions of a UserForm (https://www.excelbanter.com/excel-programming/355992-dynamically-hiding-portions-userform.html)

fly_fish_boy

Dynamically Hiding portions of a UserForm
 

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.


--
fly_fish_boy
------------------------------------------------------------------------
fly_fish_boy's Profile: http://www.excelforum.com/member.php...o&userid=32456
View this thread: http://www.excelforum.com/showthread...hreadid=522292



All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com