Hi guys, I am making a datasheet for a power substation and I created a number pad that has a command button on it called "Next" what I want this button to do is every time it is clicked it will automatically go to a specific cell and then be filled out. As of right now I do have code that works but its clunky and if I want to have an upwards of 300 specified cells its going to be a pain to hard code it all in. So I am curious to see if there is a better way? Thanks in advanced for the help.
Code:
Public s As Integer
Private Sub CommandButton15_Click()
If s = 0 Then
ThisWorkbook.Sheets("sheet1").Range("e1").Select
s = 1
ElseIf s = 1 Then
ThisWorkbook.Sheets("sheet1").Range("b5").Select
s = 2
ElseIf s = 2 Then
ThisWorkbook.Sheets("sheet1").Range("c5").Select
s = 3
ElseIf s = 3 Then
ThisWorkbook.Sheets("sheet1").Range("d5").Select
s = 4
ElseIf s = 4 Then
ThisWorkbook.Sheets("sheet1").Range("e5").Select
s = 5
Else
s = 0
End If
End Sub