adding an ID number RRS feed

  • Question

  • I put this together so i can create a date base the only think that i am having a problem is creating and ID number on column A.

    I do have an exiting data so this will continue below that as the data gents entered need to fine the last ID number on column A and add the next number for a new ID number.

    I don't know if i am in correct forum things have change since i was in this forums.

    Anyway thank you for your help.


    Private Sub Save_Click()
    Dim wks As Worksheet
    Dim AddNew As Range
    Dim lRow As Long
    Set wks = Sheet1

        On Error Resume Next
        Set AddNew = Cells.Find(What:="*", _
                        After:=Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
    Set AddNew = wks.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    ActiveCell.Offset(1, 0) = ActiveCel + 1
    AddNew.Offset(0, 0).Value = TextCompanyNumber.Text
    AddNew.Offset(0, 3).Value = TextCompanyName.Text
    AddNew.Offset(0, 4).Value = TextAddress1.Text
    AddNew.Offset(0, 2).Value = TextAddress2.Text
    AddNew.Offset(0, 5).Value = TextCity.Text
    AddNew.Offset(0, 6).Value = TextState.Text
    AddNew.Offset(0, 7).Value = TextZip.Text
    AddNew.Offset(0, 11).Value = TextZip4.Text
    AddNew.Offset(0, 14).Value = TextTelephone.Text
    AddNew.Offset(0, 18).Value = TextFax.Text
    AddNew.Offset(0, 19).Value = TextEmailAddress.Text
    AddNew.Offset(0, 30).Value = TextCompanyCode.Text
    AddNew.Offset(0, 26).Value = TextTaxId.Text
    AddNew.Offset(0, 27).Value = TextCreditcardNumber.Text
    AddNew.Offset(0, 28).Value = TextCreditcardDate.Text
    AddNew.Offset(0, 29).Value = TextCreditcardCode.Text

    End Sub


    Sunday, October 13, 2019 8:16 PM


All replies