+ Reply to Thread
Results 1 to 6 of 6

How to display active cell contents in text box

  1. #1
    Registered User
    Join Date
    04-28-2016
    Location
    Atlanta, GA
    MS-Off Ver
    Office Pro 2016
    Posts
    12

    How to display active cell contents in text box

    Hi all--

    I've been trying to teach myself vba just so I can make this enormous database easier to read. Basically, I want a textbox that will show the contents of whatever the active cell is. Ideally, I click on a cell and the contents show up in textbox1, and when I click another cell, the textbox clears and shows the newly selected cell.

    Sorry if this is a request that's been addressed already. My search turned up a ton of irrelevant results.

    I'm using Excel 2013.

    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to display active cell contents in text box

    I am sorry but I would normally ignore your request for help.

    We do not ask a lot for helping you guys, but I personally like to know the country and possibly the city of the person that I am helping.

    When someone withholds that information, I normally withhold my help.

    However as this is your first post I will help you.

    What you need is a sheet specific macro that opens a userform.

    Right Click on the sheet name at bottom of excel and select view code.

    Paste this code in the window and close it.

    Please Login or Register  to view this content.
    Selecting a cell will cause an error because Userform1 does not exist yet.

    So

    Select the developer tab and then select Visual Basic.

    Click on Insert and then Userform.

    Use the Toolbox to create a Textbox

    Close Visual Basic and select a cell.
    Last edited by mehmetcik; 03-21-2017 at 03:15 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    04-28-2016
    Location
    Atlanta, GA
    MS-Off Ver
    Office Pro 2016
    Posts
    12

    Re: How to display active cell contents in text box

    Wow, this is perfect! Thanks so much. I signed up here a long time ago just to lurk, so I never really entered any user info.

  4. #4
    Registered User
    Join Date
    04-28-2016
    Location
    Atlanta, GA
    MS-Off Ver
    Office Pro 2016
    Posts
    12

    Re: How to display active cell contents in text box

    Now that this is working so well (thanks again to mehmetcik !), I wonder if it's possible to take the text that appears in that textbox that was created above, make changes to the text, and have the changes save to the cell. The idea is that I'm comparing two columns of text and will want to keep one or the other, but sometimes I need to make a change before I keep it.

    Here is a version of what was provided to me that I made a few changes to
    Please Login or Register  to view this content.
    Apologies for non-standard formatting. Still trying to figure that out.

    Then on the user form, I have buttons that will accept one or the other column of text before moving to the next column or row.

    Am I making any sense?

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to display active cell contents in text box

    Your code looks wrong to me.

    It looks like you want to show the userform if columns B or C are selected.


    Please Login or Register  to view this content.
    Double Click on one of the textboxes in Visual basic to open the userform Macro module.

    Paste this code in the module and close it.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 03-28-2017 at 12:31 PM.

  6. #6
    Registered User
    Join Date
    04-28-2016
    Location
    Atlanta, GA
    MS-Off Ver
    Office Pro 2016
    Posts
    12

    Re: How to display active cell contents in text box

    Nice, that last bit of code did it, although I changed the cell reference—I probably wasn't clear about what I was trying to do. So much to know!

    Please Login or Register  to view this content.
    You're right, I did want to show two columns of text, but only if one of those two columns is selected. But now the whole thing works like a charm. Thanks again for your help.

+ 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. Replies: 3
    Last Post: 06-29-2015, 03:03 PM
  2. Need Macro to Find Contents of Active Cell
    By The_Darkness in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-05-2015, 01:46 PM
  3. Replies: 5
    Last Post: 01-29-2015, 05:44 AM
  4. [SOLVED] Display contents of multiple active cells in another cell?
    By mtsykes28 in forum Excel General
    Replies: 2
    Last Post: 06-14-2012, 11:27 AM
  5. Replies: 3
    Last Post: 02-09-2009, 11:16 AM
  6. Replies: 3
    Last Post: 07-08-2006, 02:45 PM
  7. Display ALL text contents in cell
    By Flipper1067 in forum Excel General
    Replies: 10
    Last Post: 07-27-2005, 09:22 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