I have two text boxes on a form. One has string or the other one has values that are separated by vbnewline. Once it reaches the string "Total" in the text box, it should insert the string after two columns. If I am inserting in column A and reached the cell that equals = "Total" it should start inserting the strings in column C and the values in column D and so forth. Right now the code below inserts everything in two columns only (A & B) without going to the next columns. How do I start inserting the the strings and values in the next columns like (C & D), (E, & F) and so on when cell value is equal to "Total"?
Dim RowNum As Integer = 2
Dim ColNum As Integer = 1
xlWorkSheet.Cells(1, 1).value = "Word"
xlWorkSheet.Cells(1, 2).value = "Value"
For Each cellA As String In txtWord.Text.Split(vbLf)
xlWorkSheet.Cells(RowNum, ColNum).value = cellA
RowNum += 1
If xlWorkSheet.Cells(RowNum, ColNum).value = "Total" Then
ColNum += 2
End If
Next
RowNum = 2
For Each cellB As String In txtValue.Text.Split(vbLf)
xlWorkSheet.Cells(RowNum, 2).value = cellB
RowNum += 1
ColNum += 2
Next