Forum Discussion

Tamara9927's avatar
Tamara9927
Copper Contributor
Jun 14, 2025
Solved

Using a checkbox to toggle the Char(10) command inside a textbox now working

Hi All, 

I am attempting to build a crude text editor by using 4 checkboxes in a row, where the first 3 checkboxes toggle on and off individual text strings in other cells, and the 4th checkbox is linked to a cell that contains the =char(10) function, to add line breaks when I choose to add them.  I have 20 lines of these checkboxes in a vertical column, and corresponding cells that contain text that display if it's checkbox is checked ("TRUE").  I then have another very basic equation just using ampersands "&'s" that join each horizontal line of texts toegther on the right hand side into 1 result cell, and a final equation (again using ampersands) that vertically gathers up these result cells into one big final result cell.  Lastly, I made an Activ-X text box, and linked that to that final result cell to display these results more visually as sort of interactive essay. 

I am using the ampersand characters to keep everything very simple, since what I wanted to do didnt work with the TEXTJOIN command, and I thought that was the problem.  Each horizontal line (using the first three checkboxes) succesfully joins the text strings together, and the result boxes work perfectly, and put everything together into one result, and I can see that in the text box.  As one big long string of text.  No problem there.  What I want to do, however, is to be able to use the 4th checkbox on each horizontal line to add a line break if I want (toggle on and off the char(10) function to add in a line break).  And that's where I'm running into a problem.  I have the properties of the Activ-X text box set to "Wrap Text".  But Excel is treating my "=char(1)" as text, not as a command.  The 4th checkbox is correctly linked to the cell with the "=char(10)" command in it, and that "=char(10)" cell is formatted to "general".   So I'm not sure how I can get this to work.  = /   Any ideas?  

A large thank you in advance to all you brilliant folks who take these questions on.  You're life-savers.  : )            

  • Select J3.

    Set the number format to General instead of Text.

    Press F2 to edit J3, then press Enter.

    Fill down from J3 as far as you want.

4 Replies

  • Select J3.

    Set the number format to General instead of Text.

    Press F2 to edit J3, then press Enter.

    Fill down from J3 as far as you want.

    • m_tarler's avatar
      m_tarler
      Bronze Contributor

      In addition to what Hans mentioned above (i.e. "=CHR(10)" is current formatted as TEXT and must be converted to general so the formula actual outputs the line break character),

      I can't speak to the activeX control but note that in a cell if you have wrap text off it will ignore the line break and with wrap text on it will respect the line break but will also wrap text as needed.  For example in this image:

      The lower blue box has wrap text on and both of the last 2 lines show how that chr(10) causes a line break BUT you can see that the 1st line also wraps text.  

      And then in the upper blue box the wrap text is off and you can see how it just spills to the right and does NOT respect the chr(10) line break.

      • Tamara9927's avatar
        Tamara9927
        Copper Contributor

        Wonderful!  Thank you so much fr the help!!  : )   

    • Tamara9927's avatar
      Tamara9927
      Copper Contributor

      Oh!  Okay.  Yes!  That worked!!   You fixed it!!!!  YAYYYY!!!!   Thank you so much!!!!     

Resources