Multiverse
New Member
- Joined
- Nov 15, 2019
- Messages
- 16
Hi
I've been working on a UserForm which loads in data from a Worksheet range, and dynamically creates a varying number of TextBoxes. I now want to dynamically add a SpinButton to each line I'm displaying in the form. The SpinButton will increment or or reduce the value of a line by a penny (or a cent). How should I handle the SpinButton _Change() Sub when the number of buttons will be dynamic?
This is how I've created the buttons:
I've uploaded an image so you can see when I'm going with this.
Many thanks!
I've been working on a UserForm which loads in data from a Worksheet range, and dynamically creates a varying number of TextBoxes. I now want to dynamically add a SpinButton to each line I'm displaying in the form. The SpinButton will increment or or reduce the value of a line by a penny (or a cent). How should I handle the SpinButton _Change() Sub when the number of buttons will be dynamic?
This is how I've created the buttons:
VBA Code:
For i = 3 To PostingsLastRow
n = n + 1
Set cSpinButton = FormInvoice.FrameInvLines.Controls.Add("Forms.SpinButton.1")
With cSpinButton
.Name = "SpinButton" & n
.Orientation = fmOrientationHorizontal
.Height = 15
.Width = 50
.Left = 940
.Top = p
End With
p = p + 20
Next i
I've uploaded an image so you can see when I'm going with this.
Many thanks!