Duplicating Excel buttons with relative reference
Solution 1:
Here's an idea. How about creating only 2 buttons (instead of hundreds) and have them move to follow the selection?
EDIT: After some discussion and clarification, OP Phil asked for the inventory update buttons to appear adjacent to the selected cell when the user clicks in column F, and be hidden otherwise.
The video below shows the operation of the tagalong buttons:
The Worksheet has a simple macro that displays and moves the buttons:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 6 Then
ActiveSheet.Shapes("Picture 1").Visible = True
ActiveSheet.Shapes("Picture 2").Visible = True
With ActiveSheet.Shapes("Picture 1")
.Left = Target.Offset(, 2).Left
.Top = Target.Offset(0).Top
End With
With ActiveSheet.Shapes("Picture 2")
.Left = Target.Offset(, 3).Left
.Top = Target.Offset(0).Top
End With
Else
ActiveSheet.Shapes("Picture 1").Visible = False
ActiveSheet.Shapes("Picture 2").Visible = False
End If
End Sub
I couldn't change the color of regular Excel command buttons, so I inserted pictures, and assigned macros to the picture objects. That's why they're referenced as Shapes("Picture 1") in the code above. If you use normal Excel command buttons, the reference would change to the name of the button.
The buttons themselves have even simpler code:
Sub Button1_Click()
ActiveCell.Value = ActiveCell.Value + 1
End Sub
Sub Button2_Click()
ActiveCell.Value = ActiveCell.Value - 1
End Sub
I hope this helps, and good luck.