This probably means that it is trying to find that worksheet in the
activeworkbook, not the add-in.
If the code is in the add-in, precede by ThisWorkbook
ThisWorkbook.Worksheets("Info").Range("B1").ClearC ontents
--
HTH
RP
(remove nothere from the email address if mailing direct)
"N E Body" wrote in
message ...
Hello All
I have a file which contains code to copy information from a sheet
called data to a sheet called Report. - Everything works fine.
I have several files to work on. Each file contains a sheet called
data. I currently have to copy each Data sheet into my file containing
the macros then run the code.
I thought it would be better if I created a menu button to run the code
and created the file as an Add-In. Then all I would need to do (once the
Add-In was installed) would be open the file containing the data and
click on the button created by the Add-In.
I added code to create a menubutton on workbook open and tested Ok so I
removed the sheet called Data and created an Add-In from the file.
When I open any of the files containing the sheet "Data" and click the
button I get Run-time error 9 - Subscript out of range - and I trace
this to the line
Sheets("Info").Range("B1").ClearContents
This is refering to the sheet that has been hidden within the Add-In
How can I get round this problem, Do I have to "Show" the sheet or is
there a particular way of refering to a sheet within an Add-In. (or
perhaps it cannot be done at all like this?
Could someone please advise me as how I can progress.
TIA
Kenny
Win NT and 2000 with Office 97
--
N E Body
------------------------------------------------------------------------
N E Body's Profile:
http://www.excelforum.com/member.php...o&userid=11263
View this thread: http://www.excelforum.com/showthread...hreadid=397456