I'm using the following code to spin through data rows on my worksheet. How could I make the code to move the data rows up and down with the help of the code. Any help on this would be kindly appreciated.
Code: Select all
Sub SpinButton1_SpinDown()
Dim vTemp As Variant
If ActiveCell.Row < ActiveSheet.Rows.Count Then
If Not IsEmpty(ActiveCell.Offset(2, 0)) Then
vTemp = ActiveCell.Offset(1, 0).Formula
ActiveCell.Offset(1, 0).Formula = ActiveCell.Formula
ActiveCell.Formula = vTemp
ActiveCell.Offset(1, 0).Select
End If
End If
End Sub
Sub SpinButton1_SpinUp()
Dim vTemp As Variant
If ActiveCell.Row > 1 Then
If Not IsEmpty(ActiveCell.Offset(-1, 0)) Then
vTemp = ActiveCell.Offset(-1, 0).Formula
ActiveCell.Offset(-1, 0).Formula = ActiveCell.Formula
ActiveCell.Formula = vTemp
ActiveCell.Offset(-1, 0).Select
End If
End If
End Sub