Microvellum Knowledge Network

Feature Request - VBA Editor for User Defined Functions

In Excel pressing Alt + F11 allows you to enter the VBA Editor where you can use Visual Basic to write user defined functions. This can be used to speed up time in Excel and save memory by using a single function instead of formulating a group of combined functions each time.

In example this is what I would like to implement to our project in MV: a function =RemoveTrailingPipe() that will look at token lists we have formulated, and if they have a pipe at the end which would make them nonfunctional, it will remove that. This can be wrapped around the formula in its own target cell whereas I currently have a separate column running =IF(RIGHT(cell-1)="|",LEFT(cell,LEN(cell)-1),cell). The separate column means more hard memory location storage and therefore slower processing of jobs.

If user defined functions were a possibility, all I'd have to do is define my function like so:

Function RemoveTrailingPipe(cell As Range) As String
    Dim str As String
    str = cell.Value  ' Get the value from the passed-in cell
    If Right(str, 1) = "|" Then  ' Check if the last character is a pipe (|)
        RemoveTrailingPipe = Left(str, Len(str) - 1)  ' Remove the last character (pipe)
    Else
        RemoveTrailingPipe = str  ' If there's no trailing pipe, return the string as-is
    End If
End Function

And then could wrap the token formula with RemoveTrailingPipe().

    MVU eLearning



    Grow Your Knowledge
    Follow along with RJ as he takes you on a journey to build your foundational knowledge of Toolbox.


      Follow us on:

               

        Google Review