Teleporpoise
New Member
- Joined
- May 23, 2019
- Messages
- 31
Hello Friends,
As the title says, I want to create a command button that when clicked, will generate a sequential number starting from 1. This is what I have coded for it
But nothing happens when I click the button. What do I do?
Thanks!
P.S. I am interested in how to reset the button back to 1. To clarify, the purpose is to have a serial number for components being processed, but I want the column A to start from 1 again if I choose a different component. Any hints to the direction I need to go?
As the title says, I want to create a command button that when clicked, will generate a sequential number starting from 1. This is what I have coded for it
Code:
Private Sub CommandButton1_Click()
If CurrentRow = 5 Then
ThisWorkbook.Worksheets("FR").Cells(CurrentRow, "A").Value = 1
ElseIf CurrentRow > 5 Then
ThisWorkbook.Worksheets("FR").Cells(CurrentRow, "A").Value = 1 + ThisWorkbook.Worksheets("FR").Cells(CurrentRow, "A").Value
End If
End Sub
But nothing happens when I click the button. What do I do?
Thanks!
P.S. I am interested in how to reset the button back to 1. To clarify, the purpose is to have a serial number for components being processed, but I want the column A to start from 1 again if I choose a different component. Any hints to the direction I need to go?