按钮在Excel工作表上移动

时间:2016-03-04 17:27:21

标签: excel vba excel-vba ms-office excel-2013

当我向下滚动时,有可能让excel工作表上的按钮与我一起移动。

谢谢,

1 个答案:

答案 0 :(得分:0)

Here is a way to make a Shape (like a Button) move as you move the activecell (for example,using the ARROW keys). Put the following code in the worksheet code area:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With ActiveSheet.Shapes(1)
        .Top = ActiveCell.Top
        .Left = ActiveCell.Offset(0, 1).Left
    End With
End Sub