+ Reply to Thread
Results 1 to 7 of 7

display long cell text in text box

  1. #1
    Registered User
    Join Date
    02-09-2020
    Location
    vienna
    MS-Off Ver
    office 365
    Posts
    5

    display long cell text in text box

    Hi all,

    I have a special case where I want to make an easy-to-read table overview on trainings, however one of the columns contains the content of the training and therefore needs to be able to display a lot of text.
    I do not want to adjust the height of the rows but rather looking for an alternative like a pop up window or something similar displaying the full text.

    I already tried with VBA a bit but as I do not have experience with VBA i could not solve the runtime error issue.

    Any help and recommendations on how display the text in the best way and/or adjust the VBA would be appreciated!

    Thanks and BR
    cricked
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,627

    Re: display long cell text in text box

    So! You posted a workbook with empty cells and an empty textbox
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    02-09-2020
    Location
    vienna
    MS-Off Ver
    office 365
    Posts
    5

    Re: display long cell text in text box

    it actually is not empty.. if you enable macros and click on a cell in the content column (F) a pop up window with its content will appear (which is done with VBA) if you then click on another cell (not in column F) the window disappears again. However if you then click again on another cell (not in column F) it shows a runtime error.
    I suppose this is due to the fact that there is no text box to delete..

    This is the code used:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim ws As Worksheet
    Static oshp As Shape
    Set ws = ActiveSheet
    If Not oshp Is Nothing Then oshp.Delete
    If Target.Column = 6 Then
    Set oshp = ws.Shapes.AddTextbox(msoTextOrientationHorizontal, 700, 100, 250, 400)
    oshp.TextFrame2.TextRange.Characters.Text = Target.Value
    End If
    End Sub

  4. #4
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: display long cell text in text box

    Hi There,
    A simple line on your code will fix the issue as following (oulined in red):
    Please Login or Register  to view this content.
    Let me know if that worked.
    Cheers,
    Filipe


    * If a reply solved or answered your query/question, you can add reputation to the person by clicking on the * Add Reputation
    * When question is resolved, please mark your thread as SOLVED


    Thanks and regards,
    Filipe Oliveira

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: display long cell text in text box

    If you delete the shape you will also need to set the object reference to nothing.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    02-09-2020
    Location
    vienna
    MS-Off Ver
    office 365
    Posts
    5

    Re: display long cell text in text box

    thanks to you both! Andy popes code works perfectly fine
    pipoliveira - your code worked however the pop up window did not disappear after clicking in another cell then column 6

  7. #7
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: display long cell text in text box

    Hi there,
    Strange, I have tested on my laptop and the pop up only appears when I click on column 6.
    Better use Andy code then.
    As it seems that you have a solution, you can now set this thread as "SOLVED" under "Thread Tools" and please add reputation to Andy
    Good Luck!
    Filipe Oliveira

+ 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. how to seperate long text in one cell and wrap the text
    By VBAidot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2016, 03:09 AM
  2. Replies: 9
    Last Post: 11-08-2015, 08:04 PM
  3. [SOLVED] If a specified range contains a text value, then display adjacent cell text?
    By adegroot13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-09-2014, 03:20 PM
  4. Replies: 11
    Last Post: 11-03-2013, 09:16 PM
  5. Replies: 7
    Last Post: 09-03-2013, 04:43 PM
  6. VBA - Import text from cell value and display in text box on cell mouse click
    By hemal89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2013, 07:20 AM
  7. [SOLVED] Find text within cell then display text to left
    By Jambruins in forum Excel General
    Replies: 5
    Last Post: 04-17-2006, 05:10 PM

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