Forum Discussion

Bakad01's avatar
Bakad01
Copper Contributor
Feb 16, 2024

Help with Macro generated by ChatGP

Hi,   I'm not a programmer so turned to ChatGP for help. My first couple of queries returned macros that worked but then I refined the search to be more accurate and ran into an issue. This line is...
  • djclements's avatar
    Feb 16, 2024

    Bakad01 The Run-time error is occurring because the first argument of COUNTIF is expecting a Range and you're passing it a value. Having said that, the formula will not work as expected anyways, because the criteria "*[a-zA-Z]*" is searching for the literal text string "[a-zA-Z]", NOT for each letter in the alphabet individually.

     

    If the objective is to identify cells in column B that contain numbers only, try this instead:

    If IsNumeric(ws.Cells(i, 2).Value) Then

Resources