Assuming you stored the name somewhere...
RowNumber = ActiveSheet.Shapes(TheButtonName).TopLeftCell.Row
where TheButtonName would be something like "Button 1".
Button.Name = "Line" & ActiveCell.Row
Sub AddButton()
With ActiveCell
ActiveSheet.OLEObjects.Add _
ClassType:="Forms.CommandButton.1", _
DisplayAsIcon:=False, _
Link:=False, _
Left:=.Left, _
Width:=.Width
End With
End Sub
With ActiveCell
ActiveSheet.OLEObjects.Add _
ClassType:="Forms.CommandButton.1", _
DisplayAsIcon:=False, _
Link:=False, _
Left:=.Left, _
Width:=.Width
End With
Button.Caption = ActiveCell.Row
Button.Name = "line" & ActiveCell.Row
And what is "Activesheet.Buttons"? Worksheet object doesn't have Buttons collection. Add button like this:
Code:Sub AddButton() With ActiveCell ActiveSheet.OLEObjects.Add _ ClassType:="Forms.CommandButton.1", _ DisplayAsIcon:=False, _ Link:=False, _ Left:=.Left, _ Width:=.Width End With End Sub
And what is "Activesheet.Buttons"? Worksheet object doesn't have Buttons collection. Add button like this:
Code:Sub AddButton() With ActiveCell ActiveSheet.OLEObjects.Add _ ClassType:="Forms.CommandButton.1", _ DisplayAsIcon:=False, _ Link:=False, _ Left:=.Left, _ Width:=.Width End With End Sub