I have multiple worksheets and wrote the function application.onkey
in the sub workbook_activate()
this function is supposed to open the UserForm on a button combination.
My problem is: If I press the button combination and the UserForm shows, it switches the sheet. No matter on which sheet I am it switches the sheet to always the same sheet. How can I prevent it from doing that?
I tried the following:
sub showingfrm()
dim tmpfrm as userform1
set tmpfrm = new userform1
With tmpfrm
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
but this doesn't seem to work. (why I am using this code is because of multiple monitors)