Invoke VBA: Exception from HRESULT: 0x800A9C68

I am getting while trying to invoke VBA code. Which was working fine before and all of sudden error comes in.
image

Code is converting negative to 0 on column H. I am using excel process scope activity.
Sub ConvertNegativesToZero()
Dim ws As Worksheet
Dim col As Range
Dim cell As Range

' Set the worksheet to the one containing your data
Set ws = ThisWorkbook.Sheets("Sales and Compare") 

' Set the column to the one you want to modify
Set col = ws.Range("H2:H" & ws.Cells(ws.Rows.Count, "H").End(xlUp).Row) 

For Each cell In col
    If cell.Value < 0 Then
        cell.Value = 0
    End If
Next cell

End Sub

Hi @Pal_Patel ,

Excel Process Scope:

  • Input: Your Excel file path.
  • Inside the scope:
    1. Read Range:
    • Input: Sheet name “Sales and Compare”, Range “”, Add Headers: True.
    • Output: DataTable variable (e.g., dtSales).
    1. For Each Row (Input: dtSales):
    • Inside the loop:
      1. If (Condition: CDbl(row("H").ToString) < 0):
      • Then:
        • Assign: row("H") = 0.
    1. Write Range:
    • Input: dtSales, Sheet name “Sales and Compare”, Range “”, Add Headers: True.

Regards
Sandy

Hi, Thanks for reply. I can try this but is there anything that I can do on that macro ? Any error or cause of the error ? I don’t know why it is failing all of sudden .

Please check with the data, any unwanted /empty space /special char can cause of this kind of error.