Excel Scrolling By Cutting Rows With Spin Buttons

Cut And Insert Row To Down/Up With VBA


          The selected row is cut and it is scrolled with spin buttons to down/up.
UserForm is opened as automatically when workbook is opened.
Spin buttons can be used on all sheets of the workbook.



The codes of userform that contains spin buttons:
Private Sub SpinButton1_SpinDown()
Rows(ActiveCell.Row).Cut
On Error Resume Next
Rows(ActiveCell.Row + 2).Insert Shift:=xlUp
Rows(ActiveCell.Row + 1).Select
End Sub

Private Sub SpinButton1_SpinUp()
Rows(ActiveCell.Row).Cut
On Error Resume Next
Rows(ActiveCell.Row - 1).Insert Shift:=xlDown
Rows(ActiveCell.Row - 1).Select
End Sub

Private Sub UserForm_Activate()
UserForm1.Top = 15
End Sub


2 comments: