[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Call user defined function in an add-in

Dale Fye

12/15/2006 1:50:00 PM

In addition to the previous post, I would like to be able to call a function
that resides in an add-in from a cell in a spreadsheet.

When I type: =FormatChart(yada, yada, yada....)
into a cell, the function seems to lock up. One of the things about this
function is that is it selects a specific worksheet, and then actually
selects cells in that worksheet. Might this be causing some of my problems?
Should I modify the code so that it only points to the sheet and cells rather
than actually selecting them?

Dale
--
Email address is not valid.
Please reply to newsgroup only.
2 Answers

Dave Peterson

12/15/2006 2:44:00 PM

0

UDF's used in a worksheet cell can't do things like selecting sheets. They
can't return a value to another cell, either. (Just a warning <bg>.)



Dale Fye wrote:
>
> In addition to the previous post, I would like to be able to call a function
> that resides in an add-in from a cell in a spreadsheet.
>
> When I type: =FormatChart(yada, yada, yada....)
> into a cell, the function seems to lock up. One of the things about this
> function is that is it selects a specific worksheet, and then actually
> selects cells in that worksheet. Might this be causing some of my problems?
> Should I modify the code so that it only points to the sheet and cells rather
> than actually selecting them?
>
> Dale
> --
> Email address is not valid.
> Please reply to newsgroup only.

--

Dave Peterson

Chip Pearson

12/15/2006 5:05:00 PM

0


> rather than actually selecting them.

Getting out of the Select habit is a very good move. It is almost NEVER
necessary to select anything in VBA. ActiveWindow.FreezePanes = True is the
only time that I can think of that you need to Select anything.

Not using Select will make your code faster and much more maintainable.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Dale Fye" <dale.fye@nospam.com> wrote in message
news:DB84B5FB-86E3-4217-B102-2DE7CA3BE198@microsoft.com...
> Thanks, Dave. I guess I'll have to rewrite the function so that it
> references the worksheets and cells, rather than actually selecting them.
>
> Dale
> --
> Email address is not valid.
> Please reply to newsgroup only.
>
>
> "Dave Peterson" wrote:
>
>> UDF's used in a worksheet cell can't do things like selecting sheets.
>> They
>> can't return a value to another cell, either. (Just a warning <bg>.)
>>
>>
>>
>> Dale Fye wrote:
>> >
>> > In addition to the previous post, I would like to be able to call a
>> > function
>> > that resides in an add-in from a cell in a spreadsheet.
>> >
>> > When I type: =FormatChart(yada, yada, yada....)
>> > into a cell, the function seems to lock up. One of the things about
>> > this
>> > function is that is it selects a specific worksheet, and then actually
>> > selects cells in that worksheet. Might this be causing some of my
>> > problems?
>> > Should I modify the code so that it only points to the sheet and cells
>> > rather
>> > than actually selecting them?
>> >
>> > Dale
>> > --
>> > Email address is not valid.
>> > Please reply to newsgroup only.
>>
>> --
>>
>> Dave Peterson
>>