+ Reply to Thread
Results 1 to 2 of 2

Thread: Assign New Number to First Blank row on open???

  1. #1
    Registered User
    Join Date
    12-16-2010
    Location
    Seattle, Wa
    MS-Off Ver
    Excel 2007
    Posts
    1

    Assign New Number to First Blank row on open???

    OK I am trying to get a macro going where every time I open my spread sheet it goes to the next available row in column A and assigns it a new number, this number I want 1 number higher then the row above it

    so basically like this

    A1
    304
    305
    306
    307

    ect.ect

    but here is the catch it cant give out a new number unless it is saved, I have tried several things but I just cant get it to put a new number in the row directly below the last number entered every time I open the program... any suggestions??

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Assign New Number to First Blank row on open???

    What do you mean by not giving a number unless it's saved?
    
    Option Explicit
    
    Private Sub Workbook_Open()
        With Sheet1
            .Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = .Cells(Rows.Count, _
                                                                        1).End(xlUp) + 1
        End With
    End Sub
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ 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.2.0