Share via

Regexpreplace function does not enable

Anonymous
2023-11-06T00:40:27+00:00

Hi,

I need to enable Regexpreplace function.

I enabled via VB tools as below:

Excel -> Developer tab -> Visual Basic -> tools -> references : Checked the check box for Microsoft regular Expressions 5.5 -> Set Ok & Saved the excel as macro enabled file. (xlsm)

But the Regexpreplace function is not getting enabled in the excel when I enter equal (=) on a cell.

Can someone please advice me on this?

Thanks.

Jinanie

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-11-06T00:51:03+00:00

    Dim reg As Object

        Set reg = CreateObject("vbscript.regexp")
    
        With reg
    
            .Pattern = "^\s*(\d{4}(?:\.\d{2}(?:\.\d{2})?)?)(.+?)((?:[,0-9]*\d\.\d{2})|(?:\([,0-9]*\d\.\d{2}\)))\s*$"
    
            .ignorecase = True
    
    End With   
    

    But the Regexpreplace function is not getting enabled in the excel when I enter equal (=) on a cell.

    I am afraid this is a lib for VBA rather than Excel formula.

    if you want to use formular,you can try

    e.g.

    =WEBSERVICE("http://e.anyoupin.cn/eh3/?regreplace~[^A-Z]~~" & A2)

    note:

    =WEBSERVICE("http://e.anyoupin.cn/eh3/?regreplace~your pattern~replacement~" & your string sddress)

    Was this answer helpful?

    0 comments No comments