+ Reply to Thread
Results 1 to 9 of 9

Interactive user-form

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Interactive user-form

    The following code is based on algorithm by another forum member.
    The user-form shows the strings in selected cell/s, and then allows the font of each character to be changed. Blank cells are bypassed.

    I'm trying to add another feature, which is to allow editing of the form and transferring values to cells (see "Private Sub EditAdd" called up using "EDIT" button).

    There are two issues:
    (1) Selection with blank cells gives an error.
    (2) Running the code also changes the font unintentionally.

    How can this be fixed?

    Snapshot.png

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Interactive user-form

    Hi, I haven't downloaded your file just read (part) of the code but with the EditAdd you are processing for each ....

    Well, the Each cell will be processed.
    I'll download your file and see if I can figure out what you are trying to achieve and if I have the time I'll work on it.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

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

    Re: Interactive user-form

    You are not consitently using the IsEmpty when checking each cell within the selection.

    You need to do it in the same way as the Initialize code.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Interactive user-form

    Hi Excel_&_Help,

    See the attached file containing the following code. It is almost a complete rewrite and redesign of what you originally had,but hopefully it is a lot easier to follow. I left your code as is, and added UserForm2. In the UserForm2 code module:
    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Interactive user-form

    Thanks for the assistance.
    With the solution at #4, the change in font made changes to all selected cells. This was supposed to be only for selected characters within the textbox.
    Modification to code at #4 now has this function.
    * There is one thing missing which I don't know will be possible. When the EDIT is made (to transfer string with new characters in textbox to cell), the font in the entire cell is affected. What happens is that all the characters in the cell take the font of the leading character. Is there a way to retain the font of each character?


    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Interactive user-form

    Thank you very much for the rep points.

    the change in font made changes to all selected cells. This was supposed to be only for selected characters within the textbox.
    The UserForm model does not allow mixing of Fonts/Colors/Style within a TextBox (or any other UserForm Control). There is allegedly a lnkEdit Control that may do what you want: https://stackoverflow.com/questions/...r-in-vba-excel

    However, you are on your own if you want to pursue that path.

  7. #7
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Interactive user-form

    I was hoping there was a way to look at each character and store the properties in an array.
    Thanks for your assistance.

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

    Re: Interactive user-form

    You can determine the font attributes of each character in a cell

    For example with the following text in a cell, Arial Calibri Times New Roman, with each font name formatted in corresponding font.
    You can use the follow line in immediate window

    Please Login or Register  to view this content.
    to generate this information.

    Please Login or Register  to view this content.
    So you can store the information and then reapply to new text in the cell but it will be based on character position only

    The same information can not be displayed in the textbox on a userform as the control does not allow for mixed formatting.

  9. #9
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Interactive user-form

    Quote Originally Posted by Andy Pope View Post
    So you can store the information and then reapply to new text in the cell but it will be based on character position only
    I think because of this, it will not work out because changes can be mid-string.
    Thanks for the input, I'll leave out this functionality.

+ 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] Interactive User Form
    By AmirSoft in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-26-2014, 07:57 AM
  2. interactive form
    By Flee0723 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2014, 12:03 PM
  3. [SOLVED] User Form to execute search and return all values to the user form for editing
    By allwrighty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 10:40 PM
  4. [SOLVED] Excel vba user form- open directly to user form not worksheet
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-24-2013, 05:07 PM
  5. [SOLVED] Excel user form- If/Then statement outcome to show on user form
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 09:16 AM
  6. Interactive Form
    By Rysky75L9 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-15-2012, 09:24 AM
  7. Interactive Form
    By Ctech in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2006, 09:10 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