Excel 2013 worksheet activate

前端 未结 9 1812
情话喂你
情话喂你 2021-01-03 03:28

I have an issue with activating a sheet from a user form, the same code works fine in Excel 2003 to Excel 2010, doesn\'t work with Excel 2013.

This is how to simply

9条回答
  •  滥情空心
    2021-01-03 03:33

    I think Dima Reznikov has the right answer. I used his C# code and did it in VBA and it seems to fix the problem. My personal code also included the use of a Modal UserForm.

    Example:

    Sub Macro1()
        Dim ws As Worksheet
        Dim win As Window
    
        '... bunch of code here...
    
        ws.Activate
        Set win = Application.ActiveWindow
        win.Visible = False
        win.Visible = True
    End Sub
    

    Hopefully this helps someone else who is also confused by the C# code.

提交回复
热议问题