1 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Use UDF output in another UDF.

Our take

Navigating the world of User Defined Functions (UDFs) can be both exciting and challenging, especially when you're looking to streamline your spreadsheet tasks. If you've created a UDF like "SumColoredCells(G3:G336)" and want to dynamically adjust its range using another UDF, "LastRow()", you're on the right path to enhancing your spreadsheet's capabilities. However, encountering a #VALUE! error when attempting to use ranges such as "SumColoredCells(G3:LastRow())" can be frustrating. In this guide, we'll explore practical solutions to integrate these UDFs seamlessly

I have a User Defined Function (UDF) called, funnily enough, "SumColoredCells(G3:G336)" which works fine. Because I am adding rows to the spreadsheet, the 336th row will increase, so I wrote another UDF called "LastRow()" to find the last used row. I would like to use LastRow() as part of the range in my SumColoredCells() UDF but if I use SumColoredCells(G3:LastRow()) I get a #VALUE! error. I have tried different things (convert to string, etc) but have not been successful.

This is not a major problem because the spreadsheet is personal and trivial but I am learning to use UDFs just to keep my brain active and challenged. This one is doing my head in.

submitted by /u/oil-filter
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Tagged with