I am trying to create an excel spreadsheet with a button that inserts a row and an ActiveX combo box above a cell containing a button. The button is selected to size and move with the cell. Since the button moves with each click (as a row above is inserted), and the user could have any cell on the sheet highlighted, I need to create a macro that is relative to the button cell, not the active cell. I accomplished the first half of this by naming the cell containing the button and recording a macro of myself (with Use Relative References selected) inserting a row above the cell containing the button. I then edited the macro containing ActiveCell.Select to Range ("NamedCell").Select so that no matter what cell the user had highlighted, it would insert a row above the button.
The issue I am having is how to insert the ActiveX combo box. The resulting code contains Left, Top, Width, and Height to position the ActiveX combo box. Since the height changes with each successive click and resulting inserted row, all of the combo boxes appear on top of each other. If this cannot happen or requires a ton of VBA code, don't worry about it. I have already learned a bunch by reading through your responses to other people. Here is the macro I currently have, but it inserts the ActiveX combo box in the same place every time instead of in the cell above the button like I want. Thanks again.
Sub AddFitting()
'
' AddFitting Macro
'
'
Range("FittingRow").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("FittingCell").Select
ActiveCell.Offset(-1, 0).Range("A1").Select
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=0, Top:=346.5, Width:=120, Height:=15.75) _
.Select
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveCell.FormulaR1C1 = "'= K value"
ActiveCell.Offset(0, -1).Range("A1").Select
End Sub