+ Reply to Thread
Results 1 to 3 of 3

code to generate serial number based on number of records

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    118

    code to generate serial number based on number of records

    I have a data in Sheet1 with few records as mentioned below. I want the result in sheet2 with column "A" serial number (number should start from A2 and should be equal to the number of records in Sheet1 (Excluding heading) Example given below. I will be adding the records in sheet2 from time to time.

    DATA

    Sheet1
    "A"
    Name (Heading)
    Sam
    Lucas
    Wilfred
    Anthony
    Josephine

    RESULT NEEDED

    Sheet2
    "A" | "B"
    Sr No. | Name
    1 | Sam
    2 | Lucas
    3 | Wilfred
    4 | Anthony
    5 | Josephine

  2. #2
    Registered User
    Join Date
    09-21-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    93

    Re: code to generate serial number based on number of records

    In sheet 2
    A2 B2
    =IF(B2<>"",ROW()-1,"") =IF(Sheet1!A2<>"",Sheet1!A2,"")

    and drag down

  3. #3
    Forum Contributor
    Join Date
    03-12-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    118

    Re: code to generate serial number based on number of records

    Thank you very much for the code. But I want VBA to drag it automatically in sheet2 till the end of record available in sheet1.

    Because I want to use the same in more than 20 sheets. So every time dragging manually is bit lengthy process

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MACRO to generate serial number in shared workbook
    By mouzie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2014, 05:31 AM
  2. how to generate serial number on a textbox in userform
    By minionrush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2013, 05:12 AM
  3. Need to generate a random serial number that automatically populates the transmittal sheet
    By chriscole412 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2012, 12:52 PM
  4. Need macro/script to generate serial number labels
    By c.young in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2012, 06:18 PM
  5. How do I generate a sequential serial number every time I tab to a new line?
    By asbo604 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-28-2009, 05:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1