Visual Basic on Mac

Severine33130 Posted messages 114 Registration date   Status Member Last intervention   -  
 Anonymous user -

Hello,

I need to create a macro in Excel to highlight the row I'm working on (visual identification), using a Mac, but I can't find how to do it because when I try to create my macro under WORKSHEET, it says "this variable uses an automation type not handled by Visual Basic."

Does anyone have the solution?

Thanks to all.

8 answers

  1. Anonymous user
     

    Good evening Séverine,

    I think it’s a matter of procedure, the order or the way...

    I just retook the test, and it worked on the first try.

    This is what I just did for the new test, in order:

    - Launch Excel

    - New document

    - Select a range of cells

    - Insert a table

    - conditional formatting / Classic / Use a formula = your formula, that is

    =row()=cell("row") in red

    - Developer menu / Visual Basic

    - select the current sheet in the Visual Basic window

    - paste this into the code page

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Set zone = Intersect(Target.EntireRow, Target.CurrentRegion)

    Application.ScreenUpdating = True

    End Sub

    - Return to the sheet for test = it works

    - Save as...

    - Choose the file type: xlsm (file supporting macros)

    - Quit Excel

    - Open the file for testing with macro activation...

    It works...


    *_Francis_*
    Have a good day, good evening, good night ;)
    iMac mid-2011 - MacBook Air M1

    1
  2. Aliboron Martin Posted messages 3661 Registration date   Status Contributor Last intervention   992
     

    Can you specify what command you are using that returns this error? Also, clarify what exactly you want to achieve.

    A priori, a contextual macro like Worksheet_Change, etc. should correspond to what you're looking for (if I understood your request correctly)...


    Hello there!
    Bernard

    0
  3. Severine33130 Posted messages 114 Registration date   Status Member Last intervention   2
     

    Hello,

    In large tables (with many columns), I would like the row I select to change color when I click on it.

    I managed to do this at the office (I work on Windows) with conditional formatting =ROW()=CELL("row") + worksheet macro: Application.ScreenUpdating=True, but when trying to replicate it at home (I work on Mac), I can't get it to work as it's not presented the same way.

    0
    1. Aliboron Martin Posted messages 3661 Registration date   Status Contributor Last intervention   992
       

      Can you describe more precisely how this macro is built? On my end, it seems to work as you described with these lines (in the code page of the concerned sheet):

       Private Sub Worksheet_Change(ByVal Target As Range) Application.ScreenUpdating = True End Sub

      When I confirm an entry with the "Enter" key, the line is colored (and the previous one turns back to white)...

      0
  4. Severine33130 Posted messages 114 Registration date   Status Member Last intervention   2
     

    1- I select a cell in my table

    2- CTRL A to select the ENTIRE table

    3- Conditional formatting with the formula =ROW()=CELL("row") in red (for example)

    4- on the sheet I am working on, I go to Developer / Visual Basic

    5- On the left side, there is PROJECT-VBProject

    6- I click on the sheet I am interested in

    7- In the middle window, there is on one side General or Worksheet (to the left of the window) and on the other side declaration (to the right)

    8- as soon as I select Worksheet, a window appears saying "This variable uses an Automation type not handled by Visual Basic"

    So I can't do anything more

    0
  5. Aliboron Martin Posted messages 3661 Registration date   Status Contributor Last intervention   992
     

    Curious. Did you double-click on the icon of the relevant sheet to "open" the code page:

    Which version of Excel are we talking about (16.83)? What version of macOS?


    Hello at your place!
    Bernard

    0
  6. Severine33130 Posted messages 114 Registration date   Status Member Last intervention   2
     

    Hello,

    Attached is a screenshot of the window that opens:

    https://www.cjoint.com/c/NCymR5ilgzW

    My Mac is stuck on Catalina version 10.15.7.

    As for Excel, it is version 16.66.1

    But normally that shouldn't affect the input of macros ?????

    0
  7. Anonymous user
     

    Hello,

    I haven't tried it personally, but I found this tutorial video:

    https://www.youtube.com/watch?v=BxGe1kJxhjY

    If I understood the question correctly...

    Best regards.


    *_Francis_*
    Have a good day, good evening, good night ;)
    iMac mid-2011 - MacBook Air M1

    0
  8. Aliboron Martin Posted messages 3661 Registration date   Status Contributor Last intervention   992
     

    Indeed, for Catalina, it is version 16.66.1. And it should not affect the basic functioning of macros (it works just as well for me under Mojave with Excel 16.54 as it does with Monterey and Excel 16.83).

    After quitting Excel, navigate to the folder ~/Library/Containers and delete the folder com.microsoft.Excel located there:

    With a bit of luck, that will be enough to put things back in order.


    Hello at your place!
    Bernard

    0
    1. Anonymous user
       

      Hello,

      I just did several tests, and I initially had exactly the same failures and error messages as Séverine. Then, after several different tests, I finally achieved the desired result:

      with this script:

      Simply clicking in a cell then causes the entire row to be highlighted.

      This is under Sonoma, with Excel 16.83...

      If it helps..

      @+

      0
      1. Sev33130 > Anonymous user
         

        Good evening,

        Well, I must be cursed... it's not working.

        Thank you for your help.

        Too bad, I'm giving up.

        Best regards.

        0