Changing the text of an Options Button on Excel for Mac 365












0















I have made a workbook on Excel for Windows and I am now trying to get it to work on Excel for Mac. (I have Office 365, so I have the most current versions of Excel on both computers.) For the most part it works fine, but there are a few things that aren't working. One bit that is really confusing me is changing the text of some Option Buttons that I have on a few different sheets. (Based on some input, the text of the Option Buttons needs to change.)



In Excel for Windows, here's how I change the text:



ThisWorkbook.Sheets("Sheet1").Shapes("OptionButton1").TextFrame.Characters.Text = "New Text"


The above works whether or not Sheet1 is the ActiveSheet, and whether or not OptionButton1 is in a column that is currently hidden.



That line of code does not work on Mac. For it to work, I have to split it up, and introduce a Select command. I also have to Activate the sheet.



With ThisWorkbook.Sheets("Sheet1")

.Activate
.Shapes.Range(Array("OptionButton1")).Select
Selection.Characters.Text = "New Text"

End With


It's annoying that after the code runs, one Option Button is selected on each page.



Another annoying thing -- I have to make sure the column that the Option Button is in is not hidden. I assume this is because I am being forced to select the Option Button itself, and it can’t do that if it’s in a hidden column?



I would love to NOT have to select the Option Button at all, but I can't figure out any other code to change the text. To be honest, the only reason I was able to come up with this code is because I recorded a macro of myself actually doing it.



If anyone knows about Excel for Mac and could help, please let me know. Thanks!










share|improve this question



























    0















    I have made a workbook on Excel for Windows and I am now trying to get it to work on Excel for Mac. (I have Office 365, so I have the most current versions of Excel on both computers.) For the most part it works fine, but there are a few things that aren't working. One bit that is really confusing me is changing the text of some Option Buttons that I have on a few different sheets. (Based on some input, the text of the Option Buttons needs to change.)



    In Excel for Windows, here's how I change the text:



    ThisWorkbook.Sheets("Sheet1").Shapes("OptionButton1").TextFrame.Characters.Text = "New Text"


    The above works whether or not Sheet1 is the ActiveSheet, and whether or not OptionButton1 is in a column that is currently hidden.



    That line of code does not work on Mac. For it to work, I have to split it up, and introduce a Select command. I also have to Activate the sheet.



    With ThisWorkbook.Sheets("Sheet1")

    .Activate
    .Shapes.Range(Array("OptionButton1")).Select
    Selection.Characters.Text = "New Text"

    End With


    It's annoying that after the code runs, one Option Button is selected on each page.



    Another annoying thing -- I have to make sure the column that the Option Button is in is not hidden. I assume this is because I am being forced to select the Option Button itself, and it can’t do that if it’s in a hidden column?



    I would love to NOT have to select the Option Button at all, but I can't figure out any other code to change the text. To be honest, the only reason I was able to come up with this code is because I recorded a macro of myself actually doing it.



    If anyone knows about Excel for Mac and could help, please let me know. Thanks!










    share|improve this question

























      0












      0








      0








      I have made a workbook on Excel for Windows and I am now trying to get it to work on Excel for Mac. (I have Office 365, so I have the most current versions of Excel on both computers.) For the most part it works fine, but there are a few things that aren't working. One bit that is really confusing me is changing the text of some Option Buttons that I have on a few different sheets. (Based on some input, the text of the Option Buttons needs to change.)



      In Excel for Windows, here's how I change the text:



      ThisWorkbook.Sheets("Sheet1").Shapes("OptionButton1").TextFrame.Characters.Text = "New Text"


      The above works whether or not Sheet1 is the ActiveSheet, and whether or not OptionButton1 is in a column that is currently hidden.



      That line of code does not work on Mac. For it to work, I have to split it up, and introduce a Select command. I also have to Activate the sheet.



      With ThisWorkbook.Sheets("Sheet1")

      .Activate
      .Shapes.Range(Array("OptionButton1")).Select
      Selection.Characters.Text = "New Text"

      End With


      It's annoying that after the code runs, one Option Button is selected on each page.



      Another annoying thing -- I have to make sure the column that the Option Button is in is not hidden. I assume this is because I am being forced to select the Option Button itself, and it can’t do that if it’s in a hidden column?



      I would love to NOT have to select the Option Button at all, but I can't figure out any other code to change the text. To be honest, the only reason I was able to come up with this code is because I recorded a macro of myself actually doing it.



      If anyone knows about Excel for Mac and could help, please let me know. Thanks!










      share|improve this question














      I have made a workbook on Excel for Windows and I am now trying to get it to work on Excel for Mac. (I have Office 365, so I have the most current versions of Excel on both computers.) For the most part it works fine, but there are a few things that aren't working. One bit that is really confusing me is changing the text of some Option Buttons that I have on a few different sheets. (Based on some input, the text of the Option Buttons needs to change.)



      In Excel for Windows, here's how I change the text:



      ThisWorkbook.Sheets("Sheet1").Shapes("OptionButton1").TextFrame.Characters.Text = "New Text"


      The above works whether or not Sheet1 is the ActiveSheet, and whether or not OptionButton1 is in a column that is currently hidden.



      That line of code does not work on Mac. For it to work, I have to split it up, and introduce a Select command. I also have to Activate the sheet.



      With ThisWorkbook.Sheets("Sheet1")

      .Activate
      .Shapes.Range(Array("OptionButton1")).Select
      Selection.Characters.Text = "New Text"

      End With


      It's annoying that after the code runs, one Option Button is selected on each page.



      Another annoying thing -- I have to make sure the column that the Option Button is in is not hidden. I assume this is because I am being forced to select the Option Button itself, and it can’t do that if it’s in a hidden column?



      I would love to NOT have to select the Option Button at all, but I can't figure out any other code to change the text. To be honest, the only reason I was able to come up with this code is because I recorded a macro of myself actually doing it.



      If anyone knows about Excel for Mac and could help, please let me know. Thanks!







      excel vba macos






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 10:06









      MattMatt

      55




      55
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I would add ActiveSheet to the code to prevent all objects named Option Button 1 from being selected at the same time




          ActiveSheet.Shapes.Range(Array("Option Button 1")).Select




          Hiding columns does not affect option buttons' visible property on Mac or Windows. Option buttons have their own hidden/visible property.



          Using this syntax works on both Mac and Windows, so why not go with it intstead of the older way?






          share|improve this answer
























          • Thanks, Jim! I will give this a go!

            – Matt
            Dec 15 '18 at 20:21











          • And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

            – Matt
            Dec 15 '18 at 20:22











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53457085%2fchanging-the-text-of-an-options-button-on-excel-for-mac-365%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I would add ActiveSheet to the code to prevent all objects named Option Button 1 from being selected at the same time




          ActiveSheet.Shapes.Range(Array("Option Button 1")).Select




          Hiding columns does not affect option buttons' visible property on Mac or Windows. Option buttons have their own hidden/visible property.



          Using this syntax works on both Mac and Windows, so why not go with it intstead of the older way?






          share|improve this answer
























          • Thanks, Jim! I will give this a go!

            – Matt
            Dec 15 '18 at 20:21











          • And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

            – Matt
            Dec 15 '18 at 20:22
















          0














          I would add ActiveSheet to the code to prevent all objects named Option Button 1 from being selected at the same time




          ActiveSheet.Shapes.Range(Array("Option Button 1")).Select




          Hiding columns does not affect option buttons' visible property on Mac or Windows. Option buttons have their own hidden/visible property.



          Using this syntax works on both Mac and Windows, so why not go with it intstead of the older way?






          share|improve this answer
























          • Thanks, Jim! I will give this a go!

            – Matt
            Dec 15 '18 at 20:21











          • And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

            – Matt
            Dec 15 '18 at 20:22














          0












          0








          0







          I would add ActiveSheet to the code to prevent all objects named Option Button 1 from being selected at the same time




          ActiveSheet.Shapes.Range(Array("Option Button 1")).Select




          Hiding columns does not affect option buttons' visible property on Mac or Windows. Option buttons have their own hidden/visible property.



          Using this syntax works on both Mac and Windows, so why not go with it intstead of the older way?






          share|improve this answer













          I would add ActiveSheet to the code to prevent all objects named Option Button 1 from being selected at the same time




          ActiveSheet.Shapes.Range(Array("Option Button 1")).Select




          Hiding columns does not affect option buttons' visible property on Mac or Windows. Option buttons have their own hidden/visible property.



          Using this syntax works on both Mac and Windows, so why not go with it intstead of the older way?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 12 '18 at 14:36









          Jim GordonJim Gordon

          212




          212













          • Thanks, Jim! I will give this a go!

            – Matt
            Dec 15 '18 at 20:21











          • And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

            – Matt
            Dec 15 '18 at 20:22



















          • Thanks, Jim! I will give this a go!

            – Matt
            Dec 15 '18 at 20:21











          • And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

            – Matt
            Dec 15 '18 at 20:22

















          Thanks, Jim! I will give this a go!

          – Matt
          Dec 15 '18 at 20:21





          Thanks, Jim! I will give this a go!

          – Matt
          Dec 15 '18 at 20:21













          And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

          – Matt
          Dec 15 '18 at 20:22





          And yes, to your point about the hidden/visible property, turns out I was mistaken. The Option Button itself was set to hidden, so I had to change it to visible before changing the text.

          – Matt
          Dec 15 '18 at 20:22




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53457085%2fchanging-the-text-of-an-options-button-on-excel-for-mac-365%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen