+ Reply to Thread
Results 1 to 3 of 3

To display data from user inputbox using UserForms in VBA excel File

  1. #1
    Registered User
    Join Date
    06-21-2019
    Location
    Mangalore,India
    MS-Off Ver
    2010
    Posts
    2

    To display data from user inputbox using UserForms in VBA excel File

    Hi, i want to display data in excel worksheet by using user inputbox for emp name,emp id, and emp phone using VBA UserForms.but when i give data in inputbox for these data the data will display in excel worksheet but when i give next record in userforms the previous displayed data would be replaced by next record data.means i want to ask the user for number of records in inputbox then display those data in excel sheet.i am posting my code.please help me.thanks

    Private Sub cmdOK_Click()
    Dim empname As String
    Dim empid As Integer
    Dim empphn As Long
    If txtEmpName = "" Then
    MsgBox "Please enter employee name"
    txtEmpName.SetFocus
    ElseIf txtEmpId = "" Then
    MsgBox "Please enter employee id"
    txtEmpId.SetFocus
    ElseIf txtEmpPhn = "" Then
    MsgBox "Please enter employee phone"
    txtEmpPhn.SetFocus
    Else
    empname = txtEmpName.Value
    empid = txtEmpId.Value
    empphn = txtEmpPhn.Value
    End If
    Range("A1").Value = txtEmpName.text
    Range("B1").Value = txtEmpId.text
    Range("C1").Value = txtEmpPhn.text
    End Sub

    Private Sub cmdNextRecord_Click()
    txtEmpName.text = ""
    txtEmpId.text = ""
    txtEmpPhn.text = ""
    Range("A2").Value = txtEmpName.text
    Range("B2").Value = txtEmpId.text
    Range("C2").Value = txtEmpPhn.text
    End Sub

    i also post the image of userform.please find that
    please provide the code for this program.thanks
    Attached Images Attached Images
    Last edited by skperla; 06-21-2019 at 02:52 AM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: To display data from user inputbox using UserForms in VBA excel File

    may be the attached approach may help.
    to add new entry first clear form, enter data, press new.
    search is done via list-box, the rest should be intuitive.
    torachan.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-21-2019
    Location
    Mangalore,India
    MS-Off Ver
    2010
    Posts
    2

    Re: To display data from user inputbox using UserForms in VBA excel File

    hi torachan thanks for the post. i could try this what you told me.Thanks for the customer excel file.Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem with worksheet display and userforms in Excel 2016
    By ersmith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2016, 12:20 PM
  2. Display excel worksheet data on a user form
    By anandagrawal444 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2015, 12:04 PM
  3. [SOLVED] MACRO: If user clicks cancel in inputbox,then do nothing. Problem with inputbox appearance
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2015, 04:33 AM
  4. Using a inputbox to get data from user to be used in IF statement
    By Sychoanalyze in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-25-2014, 08:39 PM
  5. Sort and display in accordance to data entered in the userforms
    By lokwungkwung in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2013, 11:44 AM
  6. VBA . validating user entered data (via inputbox) and error handler
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2011, 05:54 PM
  7. InputBox-ow to have a user input text in a inputbox
    By noodle48 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2011, 08:17 AM

Tags for this Thread

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