Hello smart people,
I'm trying to develop a Userform which solves engineering problems. Long story short, the user selects how many nodes their structure has (for arguments sake 1-10) using a textbook and that value is stored under the variable "NumberofNodes". On the next tab of the Userform I have a list of abels from Nodes 1 down to Node 10 with corresponding x and y coordinate text boxes next to the labels. I'm trying to figure out how to hide the labels and text boxes based on the NumberofNodes value.
For example, if the user selects 4 nodes, I'd like the Label and coordinate boxes for Nodes 5, 6, 7, 8, 9 and 10 to be hidden upon hitting an "update button". I've attached some screenshots for ease of understanding.
Im thinking something along the lines of, once the update button is pressed, this code runs
I know the syntax is clearly wrong, I'm not even sure if you can do this to begin with but any help would be greatly appreciated!!!
I'm trying to develop a Userform which solves engineering problems. Long story short, the user selects how many nodes their structure has (for arguments sake 1-10) using a textbook and that value is stored under the variable "NumberofNodes". On the next tab of the Userform I have a list of abels from Nodes 1 down to Node 10 with corresponding x and y coordinate text boxes next to the labels. I'm trying to figure out how to hide the labels and text boxes based on the NumberofNodes value.
For example, if the user selects 4 nodes, I'd like the Label and coordinate boxes for Nodes 5, 6, 7, 8, 9 and 10 to be hidden upon hitting an "update button". I've attached some screenshots for ease of understanding.
Im thinking something along the lines of, once the update button is pressed, this code runs
VBA Code:
Private Sub Update_Button_1_Click()
NumberofNodes = NumberofNodes_Box.Value
counter1 = 1
For counter1 = 1 To NumberofNodes
'eg first iteration will be Node_Label_1.visible = true
Node_Label_"&"counter1.Visible = True
'eg first iteration will be X1.visible = true
''' This correlates to the X coordinate inputbox
X"&"counter1.Visible = True
'eg first iteration will be Y1.visible = true
''' This correlates to the Y coordinate inputbox
Y"&"counter1.Visible = True
Next counter1
counter1 = NumberofNodes + 1
For counter1 = NumberofNodes + 1 To 10
Node_Label_"&"counter1.Visible = False
X"&"counter1.Visible = False
Y"&"counter1.Visible = False
Next counter1
End Sub
I know the syntax is clearly wrong, I'm not even sure if you can do this to begin with but any help would be greatly appreciated!!!