Hi All,
I have the following code to pin a command button to a specific cell. My question is how to modify this code to pin different command buttons to different cells. The code is written in the workbook activate module, so that when I open the workbook the buttons are in the correct places.
Dim rng As Range
Set rng = ActiveSheet.Range("B3")
With ActiveSheet.OLEObjects("CommandButton1")
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width
.Height = rng.RowHeight
End With
Thanks for your advice
I have the following code to pin a command button to a specific cell. My question is how to modify this code to pin different command buttons to different cells. The code is written in the workbook activate module, so that when I open the workbook the buttons are in the correct places.
Dim rng As Range
Set rng = ActiveSheet.Range("B3")
With ActiveSheet.OLEObjects("CommandButton1")
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width
.Height = rng.RowHeight
End With
Thanks for your advice