EXCEL VBA works in 1 workbook, but not another.

Tomkat53

Board Regular
Joined
Oct 22, 2010
Messages
61
I have this code which allows me to paste text from the clipboard into merged cells.
It is very handy, which is why I would like to use it in ANOTHER workbook.
However, even though it works perfectly in the workbook I created it in, when I copy/paste it into another workbook, it errors with
"User-defined type not defined."
1611940810588.png

Does anyone know why?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
You probably don't have the correct libraries/references selected on the other computer.

From the computer where it does work, go into the VB Editor, and from the Tools menu, select References.
Note which libraries/references have been selected.

Now repeat the process on the computer that does not work.
You will most likely find you are missing some. Find and select the missing ones, so this computer has all the same ones selected as the other one.
 
Upvote 0
Solution
You probably don't have the correct libraries/references selected on the other computer.

From the computer where it does work, go into the VB Editor, and from the Tools menu, select References.
Note which libraries/references have been selected.

Now repeat the process on the computer that does not work.
You will most likely find you are missing some. Find and select the missing ones, so this computer has all the same ones selected as the other one.
They are on the same computer. I run the 2 workbooks simultaneously.
 
Upvote 0
Still, follow the same procedure in each workbook as I laid out, and see if the references are exactly alike.
If they are not, correct them, and it should work.
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,786
Members
448,992
Latest member
prabhuk279

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