i want vba code to insert serial number based on cell value

Prasad K

Board Regular
Joined
Aug 4, 2021
Messages
130
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
i want vba code to insert serial number based on cell value like this below

Column A | Serial No Column B | Data if i enter data in column B then insert serial number in column A Automatically & if i delete any data row then the serial number should be update has serial
 

Attachments

  • S-1.JPG
    S-1.JPG
    21.7 KB · Views: 9
  • s-2.jpg
    s-2.jpg
    47.4 KB · Views: 9
  • s-3.JPG
    s-3.JPG
    21.1 KB · Views: 9

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,024
Office Version
  1. 365
Platform
  1. Windows
Is your Serial Number really just a row counter, like you have shown, or have you "simplified" the data for the sake of posting it here?
If you have simplified it, can you post a more realistic data sample, so we can see what kind of "pattern" you are using to determine the next value?

Note that if it really is just a row counter, you could use a formula like this (put in cell A2), and copy down column A further than you would ever need and it would show what you want (no VBA required):
Excel Formula:
=IF(B2<>"",ROW()-1,"")
 
Solution

Forum statistics

Threads
1,147,451
Messages
5,741,195
Members
423,647
Latest member
lyanndominique

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top