+ Reply to Thread
Results 1 to 7 of 7

Merge Input Box Information with Column Information

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Merge Input Box Information with Column Information

    Hello, does anybody know how to take information from an Input Box and merge it with information from a Column. It cannot delete the information from the Column it would just need to put an empty line between the information. I included a test sheet with the basic information I would have. When you hit the input button the Input Box will pop up. If I put in the Input Box that this is only a test then the first example will then say in Column E:
    this is only a test
    Hello

    The information inputted in the input box would need to go into every file that has information in Column C. Any help is appreciated.
    test macro.xlsm

  2. #2
    Forum Contributor
    Join Date
    03-12-2009
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 365
    Posts
    236

    Re: Merge Input Box Information with Column Information

    How would you determine where the new information would go? Do you just want it to go at the end of the list? Where does the file number come from? Where are all of the files that might have information in column C?

    The following code puts whatever you type to the bottom of your list:
    Private Sub CommandButton1_Click()
        'InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
        strName = InputBox("Write the note you want in Research Comments", "Research Comments")
        'Exit sub if Cancel button used or no text entered
        If strName = vbNullString Then Exit Sub
        
        Range("E" & Range("E10000").End(xlUp).Row + 1) = strName
        
        MsgBox "Hello " & strName
    End Sub
    If you can't figure out how a formula works, try stepping through it using "Evaluate Formula" in the Formula Auditing menu item in the tools menu!

    If you want to see where your code went wrong, try stepping through it by clicking in the code and pressing F8 and watch as the magic happens!


    If you are happy with any of the results, please add to the contributor's reputation by clicking the star icon.

  3. #3
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Merge Input Box Information with Column Information

    Try this. It is your code with a few changes done.

    Private Sub CommandButton1_Click()
        'InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
        strname = InputBox("Write the note you want in Research Comments", "Research Comments")
        'Exit sub if Cancel button used or no text entered
        If strname = vbNullString Then Exit Sub
        
        For x = 2 To Range("c" & Rows.Count).End(xlUp).Row
            If Range("C" & x) <> "" Then
                Range("E" & x) = strname & " " & Range("e" & x)
            End If
        Next
        
        'MsgBox "Hello " & strname
    End Sub
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  4. #4
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Merge Input Box Information with Column Information

    Thanks Everybody this works xlbiznes. Mumps1 yours works also I was just trying to get the information to show up in the beginning of the cell instead of the end. But I need to know one other thing. How would I get it to put like an [Enter] space between the two pieces of information. I'm trying to get it to look like this so when I import it back into my database it shows up correctly.

    New Information Placed on top
    Orginal Information on Bottom

    Right Now its showing up right besides each other.
    Another Test Hello Hello Test

    Maybe I'm looking at it wrong or I have a setting wrong.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Merge Input Box Information with Column Information

    I'm not sure if I understood properly but try this macro:
    Private Sub CommandButton1_Click()
        'InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
        Application.ScreenUpdating = False
        Dim bottomE As Integer
        bottomE = Range("E" & Rows.Count).End(xlUp).Row
        Dim rng As Range
        strname = InputBox("Write the note you want in Research Comments", "Research Comments")
        'Exit sub if Cancel button used or no text entered
        If strname = vbNullString Then
            MsgBox "You have not entered a note."
            Exit Sub
        Else
            For Each rng In Range("E2:E" & bottomE)
                rng = rng & " " & strname
            Next rng
        End If
    End Sub

  6. #6
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Merge Input Box Information with Column Information

    Ok , you need to change this line


     Range("E" & x) = strname & " " & Range("e" & x)
    to this

     Range("E" & x) = strname & Chr(10) & Range("e" & x)

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: Merge Input Box Information with Column Information

    Hi Trevor. It looks like xlbiznes has answered your question. In reference to my code, change
    rng = rng & " " & strname
    to
    rng = rng & Chr(10) & strname

+ 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. Trying to Merge/Combine Information
    By tfernandes49 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2013, 03:57 PM
  2. merge row information
    By eimichae in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-19-2013, 07:31 AM
  3. Merge same and different information
    By comprendrien in forum Excel General
    Replies: 9
    Last Post: 01-20-2012, 04:50 AM
  4. Excel 2007 : Merge information?!
    By pezking6983 in forum Excel General
    Replies: 2
    Last Post: 06-07-2011, 02:52 PM
  5. Merge rows of information
    By DJN in forum Excel General
    Replies: 1
    Last Post: 12-31-2009, 04:05 PM

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