VBA Button in user form opens new workbook and switches back to the original one

Kra

Board Regular
Joined
Jul 4, 2022
Messages
160
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a small problem with my user form. One of buttons opens specific workbook - Raport.xlsm. It works fine, but if I click on any cell in Raport file, excel switches back to original workbook in which macro was used. Any way to keep opened workbook activated?

VBA Code:
Private Sub CommandButton1_Click()

Unload Me
Workbooks.Open "C:\Local\Public\Raport.xlsm"

End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I used your code provided above. I do not experience the same issue here. After clicking on the button on the UserForm, the second workbook opens after the userform closes.
Clicking on a cell in the second workbook does not replicate the issue you are seeing there.


???
 
Upvote 0
Solution
I used your code provided above. I do not experience the same issue here. After clicking on the button on the UserForm, the second workbook opens after the userform closes.
Clicking on a cell in the second workbook does not replicate the issue you are seeing there.


???
Thank you for checking, I investigated everything and apparently one of add-ins was causing this trouble
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top