Results 1 to 4 of 4

Add New Field in USER Form

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-06-2015
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    520

    Add New Field in USER Form

    Dear all

    I have this code given, it works fine but i need to add 2 more fields
    cmb_staff
    txt_date
    I try to put then in the front as

    With ThisWorkbook.Sheets("main")
    NextRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
    .Cells(NextRow, 1) = cmb_staff
    .Cells(NextRow, 2 = txt_date
    .Cells(NextRow, 3 ) = cmb_city
    .Cells(NextRow,4) = cmb_nature

    However, when i enter the first time, was go to the first row rather then at the last one, 2nd enter it replaced out my record 2nd row record.

    How can i fix it

    Private Sub Btn_close_Click()

    Dim Company As String
    Dim NextRow As Long

    Company = txt_company

    With ThisWorkbook.Sheets("main")
    NextRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
    .Cells(NextRow, 1) = cmb_city
    .Cells(NextRow, 2) = cmb_nature
    .Cells(NextRow, 3) = txt_company
    .Cells(NextRow, 4) = txt_contact
    .Cells(NextRow, 5) = txt_title
    .Cells(NextRow, 6) = txt_tel
    .Cells(NextRow, 7) = txt_mail
    .Hyperlinks.Add Anchor:=.Cells(NextRow, 7), Address:="Mailto://" & txt_mail
    .Hyperlinks.Add Anchor:=.Cells(NextRow, 8), Address:="http://" & txt_web
    .Hyperlinks.Add Anchor:=.Cells(NextRow, 9), Address:="http://" & txt_shared
    End With

    Unload USER

    MsgBox Company & " has been added to the Record", 0, "Completed"
    End Sub

    Appreciated your help

    Eric
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 08-22-2018, 06:42 PM
  2. [SOLVED] Can user form fields be depenent upon the answer to another field?
    By aliciaward1001 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-20-2017, 09:43 AM
  3. [SOLVED] user form overlabps the records if one field is not filled
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-28-2015, 01:13 PM
  4. [SOLVED] How to Restrict User To Select One Field in a continuous form
    By :) Sixthsense :) in forum Access Tables & Databases
    Replies: 6
    Last Post: 03-02-2015, 01:28 AM
  5. Text box field reference in a user form
    By SinGin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2010, 09:52 PM
  6. Text field visible property on user form
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2010, 02:44 PM
  7. User Form field inserts wrong date format
    By simjambra in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-26-2009, 04:09 PM

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