Forum Discussion

jukhamil's avatar
jukhamil
Brass Contributor
Sep 28, 2021

Can we extend the VBA classes?

I am considering that I would like a method that I can call on what's returned by the VBA Range object. Because I have comma-separated values in cells, I would like to index them like in a list - Cells(1,2).Value(1), for example.

 

Is it possible to inherit the Range class, add more methods, and somehow cause that to be the standard Range object used, in the entire Excel project?

1 Reply

  • You can store what is in the cells into a variant variable considering the different delimiters (comma, etc.)
    YourVariable=Split(ActiveCell.Value, ",")
    Of course ActiveCell and comma as a delimiter is just a simple example. 

     

     

     

    Function UDFName(CellValue As Variant, _
                     Delimiter As String) As Variant
    
        UDFName = Split(CellValue, Delimiter)
        
    End Function

     

     

     

Resources