workbook or worksheets
I am going out on a limb here and assuming that your range problem was a
named range problem? Named ranges are somewhat odd in that they can exits at
the worksheet level or at the borkbook level. Try this. Create a worksheet
with a named range on it. Now copy the worksheet. You now have two named
ranges both with the same name. The workbook version has presidence over the
worksheet version. You can confirm that for yourself by Hitting F5. Only one
of your named ranges is listed. The other is a cell range reference. That is
probably where the problem stemmed from. Assuming named ranges...
Is it better to associate code with a workbook or with a worksheet. That
depends on the scope of the function or procedure. If the function is
specific to one sheet then put it in the sheet. If the function is more
utilitarian than that and could be used by multiple sheets then put it in a
module. That is a little oversimplified but simple is good.
--
HTH...
Jim Thomlinson
"David Gerstman" wrote:
<a
href="http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.excel.programming &mid=127739c5-cb43-423a-b963-855688533e0f&sloc=en-us"Earlier</a
I had asked about a Range problem. Eventually, I played around and solved it
simply by moving the macro from being associated to one of the worksheets to
being associated with "This Workbook."
I don't understand why this made a difference since I was referred to
specific worksheets in the code.
This begs a few questions:
1) Is it better form to associate a macro with a specific worksheet or to
the workbook?
2) If I'm associating the macor to a worksheet what are the limitations?
Thanks,
David
|