jeudi 12 septembre 2019

How to fix undefined function error in VBScript

Thank you in advance for your help. I'm coding vbscript to modify excel files in a loop, based on the name of the tabs in the excel file. I have the code below, and it's crashing at the the first IF statement, telling me that I have a "sub or function not defined". Any help is appreciated. Thanks! Bob

I have tried renaming the dim WS, or directly using Worksheet in it's place.

Dim ws
ws = "worksheet"
For each ws in xlFile.Worksheets
  If ws.Name Like "Table" & "*" Then
  ws.Range("B6").Clear
    ws.Range("A:XFD").Replace "#N/A", "-", False
  End If
next

When running the full code, I receive the error: "sub or function not defined" I'm a little confused because the only function I (think) I'm referring to is the IF THEN statement, and that seems pretty straight forward.

Aucun commentaire:

Enregistrer un commentaire