Consulting

Results 1 to 3 of 3

Thread: insert auto serial number in user form

  1. #1

    insert auto serial number in user form

    hi there ,
    i have excel sheet which have serial number for the data in column a and i want the text1"textbox"to have default value which is last value in column a +1
    pls review my code which i am sure its so bad coz i am newbie and thnx in advance ..

    Text1.Value = Cells(Column, "a").End(x1up).cell.Value + 1

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Private Sub UserForm_Initialize()
    Dim NewSerno As Long
    
    NewSerno = [Sheet].Cells(Rows.Count, "A").End(xlUp).Value + 1
    [Sheet].Cells(Rows.Count, "A").End(xlUp.Offset(1) = NewSerno
    Text1.Value = NewSerno
    End Sub
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Quote Originally Posted by SamT View Post
    Private Sub UserForm_Initialize()
    Dim NewSerno As Long
    
    NewSerno = [Sheet].Cells(Rows.Count, "A").End(xlUp).Value + 1
    [Sheet].Cells(Rows.Count, "A").End(xlUp.Offset(1) = NewSerno
    Text1.Value = NewSerno
    End Sub
    Thanks sir for your help i really appreciate it

Posting Permissions

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