There's no need to store a counter in a cell in the workbook. You can use a static variable instead.
Paste the following code into any non-class module:
'============================================================================================
' Module : <any non-class module>
' Version : 0.1.1
' Part : 1 of 1
' References : N/A
' Source : https://superuser.com/a/1331173/763880
'============================================================================================
Option Explicit
Public Sub Next_Click()
Const s_DestSheet As String = "Sheet1"
Const s_DestRange As String = "B5"
Const s_SrcSheet As String = "Sheet2"
Const s_SrcCell As String = "A1:A10"
Static sidxCurrentCell As Variant: If IsEmpty(sidxCurrentCell) Then sidxCurrentCell = -1
With Worksheets(s_SrcSheet).Range(s_SrcCell)
sidxCurrentCell = (sidxCurrentCell + 1) Mod .Cells.Count
.Cells(sidxCurrentCell + 1).Copy Destination:=Worksheets(s_DestSheet).Range(s_DestRange)
End With
End Sub
Then assign it to your button.
The only issue with this code is that it doesn't remember which cell it was up to when you re-open the workbook, and restarts from the first cell. This can be worked around if desired.
Addendum:
If you also wish to have a "Previous" button to cycle backwards, it gets slightly trickier - you need a generalised Previous/Next subroutine with a parameter to determine the direction. Then, each button needs to be assigned to separate subroutines that call the main routine with the appropriate argument:
'============================================================================================
' Module : <any non-class module>
' Version : 0.2.0
' Part : 1 of 1
' References : N/A
' Source : https://superuser.com/a/1331173/763880
'============================================================================================
Option Explicit
Private Sub Next_or_Previous( _
ByRef direction As Long _
)
Dim plngDirection As Long: plngDirection = direction
Const s_DestSheet As String = "Sheet1"
Const s_DestRange As String = "B5"
Const s_SrcSheet As String = "Sheet2"
Const s_SrcCell As String = "A1:A10"
Static sidxCurrentCell As Variant: If IsEmpty(sidxCurrentCell) Then sidxCurrentCell = -plngDirection
With Worksheets(s_SrcSheet).Range(s_SrcCell)
sidxCurrentCell = (sidxCurrentCell + plngDirection + .Cells.Count) Mod .Cells.Count
.Cells(sidxCurrentCell + 1).Copy Destination:=Worksheets(s_DestSheet).Range(s_DestRange)
End With
End Sub
Public Sub Previous_Click()
Next_or_Previous -1
End Sub
Public Sub Next_Click()
Next_or_Previous 1
End Sub
2So, what have you tried so far? – music2myear – 2018-06-13T23:54:29.213