ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   increment number by code (https://www.excelbanter.com/excel-programming/334858-increment-number-code.html)

nowfal[_16_]

increment number by code
 

Hi experts,
I think the following question would be very easy one.
Now i am using a very simple formula =b1+1 for incrementing the serial
number. But the problem comes when somebody try to delete the row the
formula affected. So is it possible to write a code for that ? if so
where do i place it , in worksheet module ?
thanks
by
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=388110


gbor

increment number by code
 

In Cell B2
=OFFSET(A2,-1,0)+1

This should work because the cell only references itself



"nowfal" wrote:


Hi experts,
I think the following question would be very easy one.
Now i am using a very simple formula =b1+1 for incrementing the serial
number. But the problem comes when somebody try to delete the row the
formula affected. So is it possible to write a code for that ? if so
where do i place it , in worksheet module ?
thanks
by
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=388110



gbor

increment number by code
 
Sorry, I had a typo in the first post

In Cell B2
=OFFSET(b2,-1,0)+1

This should work because the cell only references itself


"nowfal" wrote:


Hi experts,
I think the following question would be very easy one.
Now i am using a very simple formula =b1+1 for incrementing the serial
number. But the problem comes when somebody try to delete the row the
formula affected. So is it possible to write a code for that ? if so
where do i place it , in worksheet module ?
thanks
by
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=388110



nowfal[_18_]

increment number by code
 

Thanks a lot g bor, it works. But still a question is it possible to
have it programatically by a code.
regards
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=388110



All times are GMT +1. The time now is 02:43 AM.

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