I have set a table from Col A to B
Col A contains numbers from 1
I want once I've entered data in B1 and press "Enter"
The table auto opens a new row (Row 2) and in A2
It auto shows the row number (that should be 2) and
This process goes on...
A B
1 1 a
2
I've taken ref from one of the experts's codes here and tried tweaking it a bit but my effort fails.
Code:
Option Explicit
Sub auto_open()
ThisWorkbook.Worksheets("Sheet1").OnEntry = "add"
End Sub
Sub add()
Dim lastrow As Long
With Sheets("Sheet1")
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Cells(lastrow + 1, 1).Value = Cells(lastrow - 1, 1).Value + 1
End Sub
I'm totally green in VBA.
Could anyone help?