+ Reply to Thread
Results 1 to 6 of 6

VBA Code to Concantenate Two Columns to Userform Textbox

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    New Jersey
    MS-Off Ver
    Excel 2003
    Posts
    9

    VBA Code to Concantenate Two Columns to Userform Textbox

    I'm thinking the solution to this is simple enough but I'm perplexed. I can't attach the main spreadsheet because there are some security concerns but my problem can be explained in generic terms. I need to concatenate two columns from the activesheet to a textbox on a userform. In column A2 thru A14 I have Cycles 1-13 (Cycle 1, Cycle 2,...Cycle 13). I also have times for each of those Cycles in H2 thru H14. I'm having problems with this alone, but on the same spreadsheet the whole situation is repeated after skipping a few rows (A20-A30 Cycles & H20-H30 Times) which probably complicates things more. I'd like the layout in the textbox to resemble this...

    Cycle 1 - 12:00 pm
    Cycle 2 - 1:00 pm
    Cycle 3 - 4:00 pm
    Cycle 15 - 6:00 pm
    Cycle 20 - 9:00 pm
    ...and so on

    I've searched the forums and tried modifying the code I found to suit my needs but to avail. I'd appreciate any assistance. I created a simple spreadsheet as an example just in case my explantion is not concise enough. Thanks in advance.
    Attached Files Attached Files
    Last edited by SlappyDikkinz; 07-08-2014 at 03:08 PM. Reason: problem solved

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

    Re: Concantenate Two Columns to Userform Textbox

    What exactly is the problem?

    Also, couldn't you use a listbox to display the data?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-16-2014
    Location
    New Jersey
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Concantenate Two Columns to Userform Textbox

    Quote Originally Posted by Norie View Post
    What exactly is the problem?

    Also, couldn't you use a listbox to display the data?

    I thought the header said it all "Concantenate Two Columns to Userform Textbox". Basically A & H but there's two groups of Audits on my example spreadsheet and they're separated by 4 empty cells. Am I making sense?

    No I can't. The textbox is being used for other things besides this and a listbox wouldn't be appropriate.

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

    Re: Concantenate Two Columns to Userform Textbox

    Sorry but the title doesn't really explain what you are having problems with.

    Is it locating the data? Concatenating? Displaying it in the textbox?

    This code will put the data from Sheet1 in your workbook in TextBox1 of a userform with each 'cycle' on a new line.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-16-2014
    Location
    New Jersey
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Concantenate Two Columns to Userform Textbox

    Quote Originally Posted by Norie View Post
    Sorry but the title doesn't really explain what you are having problems with.

    Is it locating the data? Concatenating? Displaying it in the textbox?

    This code will put the data from Sheet1 in your workbook in TextBox1 of a userform with each 'cycle' on a new line.
    Please Login or Register  to view this content.
    I was looking for code to merge the text from columns A & H regardless of whats in them and write that merged text into a textbox on multiple lines. It appears your code would only work if the word Cycle is in column A. I was looking for something a bit more generic however I can use this. Don't think I'm not grateful lol

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

    Re: Concantenate Two Columns to Userform Textbox

    If you just want to check there's something in column A change the If statement to this.
    Please Login or Register  to view this content.

+ 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. [SOLVED] Need Concantenate rows across Multiple columns
    By dmerrick64 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2013, 03:20 PM
  2. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  3. Userform Textbox updating a another userform textbox (im stuck!!)
    By wapwap in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-31-2011, 02:56 PM
  4. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 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