+ Reply to Thread
Results 1 to 5 of 5

Macro to enter record number in column A

  1. #1
    Registered User
    Join Date
    03-14-2006
    Posts
    23

    Macro to enter record number in column A

    I suspect this is pretty simple. I need a macro to insert in column A a record number beginning in cell A2 and running the length of the data, which will vary. The number of records could be linked to the information in column D, which will always have data in every cell for the length of the sheet.

    Many thanks.

  2. #2
    papou
    Guest

    Re: Macro to enter record number in column A

    Hello
    With Worksheets("YourSheet")
    For i = 2 to .Range("D65536").End(xlUp).Row
    ..Cells(i,1).Value = 'Your Number here
    Next i
    End With

    HTH
    Cordially
    Pascal



  3. #3
    Registered User
    Join Date
    03-14-2006
    Posts
    23
    Thanks Pascal. Almost there it seems. The macro puts a "1" in every cell. I need this to read consecutively. 1, 2, 3, 4, etc.

    Sub testnumber()
    With Worksheets("M_Formatted Data")
    For i = 2 To .Range("D65536").End(xlUp).Row
    .Cells(i, 1).Value = 1
    Next i
    End With
    End Sub

  4. #4
    papou
    Guest

    Re: Macro to enter record number in column A

    Hello
    Sub testnumber()
    With Worksheets("M_Formatted Data")
    For i = 2 To .Range("D65536").End(xlUp).Row
    Cells(i, 1).Value = i - 1
    Next i
    End With
    End Sub

    HTH
    Cordially
    Pascal



  5. #5
    Registered User
    Join Date
    03-14-2006
    Posts
    23
    Thank you Pascal. C'est parfait.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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