Using the next reference number automatically

  • Thread starter Thread starter Novicer
  • Start date Start date
N

Novicer

Can someone please help me to write a macro that can help me access the next
available sequential number (1, 2, 3, 4, etc) from an existing worksheet? For
example, if Rows 1 - 5 already has data entered already, I want to reference
my formulas to Rows 6 (that is avaialbe) automatically. Thanks!
 
Hi

With data in column A, this will return the number of first empty row:

FirstEmptyRow = Range("A1").End(xlDown).Row + 1

Hopes it helps

Regards,
Per
 
Let's say you want to put a formula in the next cell in column A

Dim myWS as WOrksheet
dim myRange as range
Set myWS = activesheet
Set myRange = myWS.cells(myws.rows.count,1).end(xlup).offset(1,0)
myRange.formulaR1C1 = ... put your formula here.
 
Back
Top