简体   繁体   中英

return “highlight” from userform to worksheet with vba in excel 2010

I have a worksheet and a userform shown in vbModeless mode, as I need it to be visible all the time. The userform includes a button. This button does a specific job, depending on the current selected cell at the worksheet. After pressing the button, highlight stays at the userform.

What I need is, after pressing the button, highlight to return at the worksheet and be able to scroll at the worksheet or use the arrows (keyboard), without having to clic at the worksheet first. I tried this:

Private Sub CommandButton1_Click()
    ...
    Worksheets(1).Activate
End Sub

but it doesn't do what I want. I also tried the recorder but I got an error. What's the code for doing this?

这个怎么样:

AppActivate Application.Caption

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM