Increment function

53 views
Skip to first unread message

MICHAEL PEMBERTON

unread,
Jun 17, 2024, 11:12:03 AMJun 17
to Excel-DNA
I am trying to create a function that increments the value in a cell without using a global variable.  I'm using vb.net.  I seem to be able to retrieve the value from any other cell on the worksheet, except the cell calls the function, which is the cell i want to increment.  Is there a way to do this without using a global variable?


Kedar Kulkarni

unread,
Jun 18, 2024, 11:56:26 AMJun 18
to Excel-DNA
My suggestion is that this is a bad design / idea to try to access the same cell that is being calculated. You should use a global variable / dictionary that stores fully qualified cell address as key and value is int. again it may give unpredictable results but what you are trying to do is similar to circular reference.

MICHAEL PEMBERTON

unread,
Jun 18, 2024, 2:17:32 PMJun 18
to exce...@googlegroups.com
Thank you, Kedar. I suspect you're right. I wish this was a built in function in Excel. I may try some scoping strategy to limit it to a sheet.  But we'll see.  Again, it runs really slow in the dll as opposed to a straight macro. bummer.


--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/a08df06f-89f9-41c2-94b5-fa4d589333aan%40googlegroups.com.

Kedar Kulkarni

unread,
Jun 18, 2024, 2:25:50 PMJun 18
to exce...@googlegroups.com
just make sure that you run the application in release mode and not in debug mode (if not done already).

The Excel DNA shines when we have to do things that are not easy with vba and uses modern technologies (eg using json / XML/ REST API, serialization/deserialization, running custom functions asynchronously, RTD, writing really large applications, protecting IP, avoid corrupt workbooks/addin files etc). 

Macros have their own place in the ecosystem and if that makes sense then  use it. Excel DNA is just another tool that helps to customize excel. 

M Bilal Khan

unread,
Jul 5, 2024, 11:23:33 AMJul 5
to exce...@googlegroups.com

Sir how much important DNA for the excel user tell me plz I'm excel lover and I learn 150+function in excel but I don't know Excel VBA .


Reply all
Reply to author
Forward
0 new messages