+ Reply to Thread
Results 1 to 3 of 3

Data from UserForm to Excel sheet

  1. #1
    Registered User
    Join Date
    03-17-2005
    Posts
    11

    Data from UserForm to Excel sheet

    Ok, this is my problem.

    I have got a userform where the user eneters data into 5 text boxes & selects an option from 1 list box.
    I want this data to neter on the a row in the excel sheet. Say 1st entry of data inserts into row 2 of excel sheet.

    My current code:

    Dim NextRow As Long

    'find vacant row in column A
    NextRow = Range("A65536").End(xlUp).Row + 1

    'enter data from form
    Cells(NextRow, "B").Value = frmuser.txtlabel.Value
    Cells(NextRow, "D").Value = frmuser.txtmain.Value
    Cells(NextRow, "E").Value = frmuser.txtother1.Value
    Cells(NextRow, "F").Value = frmuser.txtother2.Value
    Cells(NextRow, "G").Value = frmuser.txtother3.Value
    Cells(NextRow, "C").Value = frmuser.lstsection.Value
    frmuser.Hide

    This code is placed in a confirm button on the user form. This code will only place one of the values into 1 cell & will not go onto the next row when the row is filled but just replaces the first row.

    Can anyone help?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    nollaig

    When I posted how to get the next row I assumed there was data in column A.

    If there isn't any data in column A NextRow will always return 2.

    Try using another column like this.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-17-2005
    Posts
    11
    Norie,

    It works now!! Thanks for that

+ 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