Try to paste in to an open worksheet but results appear in a different worksheet

Starkey

Board Regular
Joined
May 5, 2006
Messages
187
Hi all. Random question I hope you can help me with please

I've built an app whereby a user clicks on a button on Sheet1 and a userform pops up. The userform contains a menu of options. Certain options are only available to that user once they update a particular table (worksheet). They do this by copying the results of an SQL query in to the worksheet. The process is:

- User opens the userform by clicking a button on Sheet1
- User clicks on an option from the userform menu
- Msgbox pops up informing user to run a query and copy the results in to a table first
- Userform automatically unloads (Unload Userform28)
- User is taken to the table (worksheet):

Sheets("Brands").Select
Range("A1").Select

- User runs the query in SQL and copies the results in to the clipboard (CTRL-C)
- User then pastes the results in the worksheet "Brands" (CTRL-V)

However the issue is that the results actually get copied on to Sheet1 (the sheet with the button that opens userform28) and not the visible sheet ("Brands")

Completely puzzling me - screenupdating is off. The worksheets are all visible. I added a further line of code (Worksheets("Brands").Activate) but that had no effect

Any help would be much appreciated
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Don't you want ScreenUpdating ON if the user is interacting with your workbook?
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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