If statement problem in Libre Office Macro [SOLVED]

Hi!

I want to write my data but some of my data is null. Instaeed of null data, I want to write “0”

My if statement doesn’t work. What can I do for it? Can you help me?

My code is here:

rA = CreateUnoStruct("com.sun.star.table.CellRangeAddress")
cA = CreateUnoStruct("com.sun.star.table.CellAddress")  
    For iCount2 = 1 to 14
	
With rA
  .Sheet       = 5
  .StartColumn = iCount2*2
  .StartRow    = iCount+5
  .EndColumn   = iCount2*2
  .EndRow      = iCount+5
 
End With
With cA
  .Sheet       = 6
  .Column      = 2
  .Row         = (iCount*21)+(18-iCount2)
End With
if rA = NULL Then
ThisComponent.Sheets(6).CopyRange(cA, 0)
Else
ThisComponent.Sheets(6).CopyRange(cA, rA)
End If

Next iCount2

I solved my problem with other way.

My new code is here:

For iCount9 = 0 to 1226

	For iCount8 = 1 to 14
	dim document as object
	document = ThisComponent
	sheet = document.Sheets(6)
	if sheet.getCellByPosition(2, (iCount9*21)+(18-iCount8)).String = empty Then
With rA
  		.Sheet       = 6
  	    .StartColumn = 10
		.StartRow    = 22
		.EndColumn   = 10
		.EndRow      = 22
End With
With cA
  		.Sheet       = 6
  		.Column      = 2
  		.Row         = (iCount9*21)+(18-iCount8)
End With



	ThisComponent.Sheets(6).CopyRange(cA, rA)
	
	
	
	
	else
	sheet.getCellByPosition(2,(iCount9*21)+(18-iCount8))
	end if
	Next iCount8
	Next iCount9