I need to sort through a bunch of rows with email addresses, names, and other information to remove the spam emails. Since real names are usually under fifteen characters, I decided to delete all the rows that have over fifteen characters. I tried to write a macro to do this, but all it is doing is deleting some rows, over fifteen characters or not.
Sub Main
Dim currDoc as Object
Dim currSheet as Object
Dim currCell as Object
Dim cellString as String
Dim stringLength as Integer
currDoc = ThisComponent
currSheet = currDoc.sheets(0)
For i = 1 To 100000 Step 1
currCell = CurrSheet.getCellByPosition(1, i)
cellString = currCell.String
stringLength = LENB(cellString)
If stringLength > 15 Then
currSheet.rows.RemoveByIndex(1, i)
End If
Next
print "Finished"
End Sub