ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using the next reference number automatically (https://www.excelbanter.com/excel-programming/416367-using-next-reference-number-automatically.html)

Novicer

Using the next reference number automatically
 
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!

Per Jessen

Using the next reference number automatically
 
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

"Novicer" skrev i meddelelsen
...
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!



Barb Reinhardt

Using the next reference number automatically
 
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.
--
HTH,
Barb Reinhardt



"Novicer" wrote:

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!



All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com