iaindowner
New Member
- Joined
- Aug 12, 2014
- Messages
- 18
I have a userform which contains a number of textbox fields. It also contains a command button. Upon clicking the command button at the bottom of the user form I want to create a button which contains code dependent on the textbox values in the userform. I already have the code to create the button but I can't work out how to code the button.
I need to add the code:
The only issue is that both of the areas highlighted in red above must match the value of one of the textbox fields in the userform which is NP.NT.Value
Code:
Private Sub Add_Click()
Sheets(Sheet.Value).OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=100, Top:=100, Width:=102, Height:=54).Name = NP.NT.Value
Application.ActiveWorkbook.Sheets(Sheet.Value).Shapes(NP.NT.Value).DrawingObject.Object.Caption = NP.NT.Value
End Sub
I need to add the code:
Code:
Private Sub [COLOR=#ff0000][U][B]NEWBUTTON[/B][/U][/COLOR]_Click()
Range("I60").End(xlUp).Offset(1, 0).Value = [U][B][COLOR=#ff0000]"RED SQUARE"[/COLOR][/B][/U]
Range("I60").End(xlUp).Offset(0, 1).Value = 1
End Sub
The only issue is that both of the areas highlighted in red above must match the value of one of the textbox fields in the userform which is NP.NT.Value