Public Toggle
Private Static Sub CommandButton1_Click()
For Each Shape In activesheet.Shapes
Shape.Delete
Next
If Toggle = False Then
For i = 17 To 1240
If Cells(i, "J") = "" Then
Cells(i, 10).Select
Exit For
End If
Next
Toggle = True
Else
For i = 1261 To 2484
If Cells(i, 10) = "" Then
Cells(i, 10).Select
Exit For
End If
Toggle = False
Next
End If
With activesheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, _
DisplayAsIcon:=False, left:=120, top:=72, width:=50.4, height:=30)
.name = "CommandButton1"
.Object.Caption = "Bottom"
End With
With activesheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, _
DisplayAsIcon:=False, left:=520, top:=(ActiveCell.top), width:=50.4, height:=30)
.name = "CommandButton2"
.Object.Caption = "Top"
End With
End Sub
Private Sub CommandButton2_Click()
Cells(1, 1).Select
End Sub