Hello there,
I believe the following code will work for you, assuming that your data is like your example spreadsheet, where your data with spin buttons starts at row 2 and continues until the Last row of data, A contains the first number, B contains the number you want to change with the spin button, C is where the spin button is going to be placed and D is the formula A+B. Finally, the row height of the rows is 15 that contain a spin button is 15.
To use this code in your workbook:
- Select and delete the Spin Buttons you have on your worksheet in column C
- Press Alt + F8
- Clear the macro name field and then type AddSpin
- Select the Create option
- In between the Sub AddSpin() and End Sub copy and paste the above code
- Anything that appears in green is a comment meant to help you understand the code
- Close out of Visual Basic
- Press Alt+F8
- Select the AddSpin macro
- Select the Run option
This code should add activex spin buttons whose linked cell is in the current row that the spinbutton is.
Let me know if this works for you.
Attached is your original file for testing.
Press Alt+F8, Select Macro1 and then select Run to watch it work.
Thanks!
Bookmarks