Excel 2013 worksheet activate

前端 未结 9 1822
情话喂你
情话喂你 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:54

    Wow, I was able to reproduce this error using 2013. This is a fantastic failure of Excel's new SDI Interface. What is also interestingly odd is that when you follow the following steps

    • Select cell A1 on Sheet1
    • Select cell B2 on Sheet2
    • Click Button2 which opens the form
    • Click the CommandButton1 on the form (which hides the form and activates Sheet2)

    it looks like cell B2 on Sheet2 is selected, but when you start typing, the text is going into cell A1; Once you hit Enter the text disappears to cell B2 on Sheet1

    You almost have to see it to believe it.

    The only thing that I've found that works is using the Ontime function.

    Private Sub CommandButton1_Click()
        Unload Me
        'Call Macro1
        Application.OnTime Now(), "Macro1"
    End Sub
    

    ...but I have a feeling that this isn't going to help everyone

提交回复
热议问题