Why erro 35 in "Cells" (VBA)?

The Coide is:

Option VBASupport 1

Sub Macro1()

Dim linha As Integer

linha = 9

While Cells(linha, 2).Value <> ""

    If Cells(linha, 3).Value > 1500 Then

        Cells(linha, 4).Value = 0.05 * Cells(linha, 3).Value

    End If

    linha = linha + 1


End Sub

But in While Cells(linha, 2).Value <> " " presents error 35, and in excel it normally runs.

Could anyone explain what was going on?

Your macro works for me in my LO 6.1.6 version, and in LO 7.1.0 Portable version.

Which version are you using?

What object/event launches your macro in your document?

Maybe some other parts of your code conflicts with this sub. Please upload the full code in a sample ODF file.

VBA macro.ods

Your code run here, but the mine no

I’m using the version 7.0.

I had to create a new file in ODF for run. I believe the problem was in the Excel xlsm and xlsx file.

Thanks for explain