Option Explicit
Sub CheckBlankResultOfFormula
	Dim oDoc, oSheet, oCell As Object
	oDoc = ThisComponent
	oSheet = oDoc.CurrentController.ActiveSheet
	Dim i As Integer	
	Dim t As String
	For i = 0 To 1000
		oCell = oSheet.getCellByPosition(1, i)
		If 		oCell.String = "" Then
'				Next
				GoTo ComeHere
		ElseIf 	oCell.String <> "End" Then
				t = t & oCell.String & Chr(10)
		ElseIf 	oCell.String = "End" Then
				t = t & "End"
		End If
ComeHere:
	Next
	MsgBox t,,"Result"
End Sub
Why can’t Next exit IF - ElseIf - End If ?
0032CheckBlankResultOfFormula.ods (12.7 KB)
LibreOffice:
Version: 7.3.5.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.5-0ubuntu0.22.04.1
Calc: threaded
OS:
Ubuntu 22.04 LTS
 
      
    