How to change worksheetfunction to VBA for excute macro?

help

this is worksheetfunction…
=IF(OR(ISNUMBER(SEARCH(“M21”,AI3)),ISNUMBER(SEARCH(“M23”,AI3)),ISNUMBER(SEARCH(“M24”,AI3)))=TRUE,IF(OR(ISNUMBER(SEARCH(“S”,K3)),ISNUMBER(SEARCH(“G”,K3)),ISNUMBER(SEARCH(“I”,K3)))=TRUE,AE3,IF(ISNUMBER(SEARCH(“up”,W3))=TRUE,AE3-3000,AE3-2000)),IF(ISNUMBER(SEARCH(“M22”,AI3))=TRUE,IF(OR(ISNUMBER(SEARCH(“up”,W3)))=TRUE,AE3-3000,AE3-2000),AE3))

this is how i tried to change
If InStr(1, Cells(k, “AI”), “M21”) Or _
InStr(1, Cells(k, “AI”), “M23”) Or _
InStr(1, Cells(k, “AI”), “M24”) Then
If InStr(1, Cells(k, “K”), “S”) Or _
InStr(1, Cells(k, “K”), “G”) Or _
InStr(1, Cells(k, “K”), “I”) Then corWs.Cells(k, “DB”).Value = corWs.Cells(k, “AE”).Value
ElseIf InStr(1, Cells(k, “W”), “up”) Then corWs.Cells(k, “DB”).Value = corWs.Cells(k, “AE”).Value - 3000
Else: corWs.Cells(k, “DB”).Value = corWs.Cells(k, “AE”).Value - 2000
End If

@CJW
Hi,
You can write this code in the Bas file, and then use the invoke VBA to achieve your needs
Regards.

Thanks!!

Is there a different way of handling “Invoke vba” and “Execute Macro”? Are there any activities that can use the worksheet function?