Hi Friends,

Please go through the following code and correct it. What I want is the cell has to split if it is not null. Please tell me the logic. If it null I have to move that row to other sheet.

please provide the logic


Dim com_salt_batch As Variant

Dim Wells As String


'assigns wells field data from source sheet to Wells

Wells = Sheets("source").Range("B" & counter).Value

'split the current cell by the "-" character into another array
com_salt_batch = Split(Wells, "-")
'Merge first two split values back together and put in column A
Sheets("11514SD").Cells(counter, "A") = com_salt_batch(0) & "-" & com_salt_batch(1)

' if array UBound is 2 it loads into Batch field
If UBound(com_salt_batch) = 2 Then
Sheets("11514SD").Cells(counter, "C") = com_salt_batch(2)
Else
Sheets("11514SD").Cells(counter, "B") = com_salt_batch(2)
Sheets("11514SD").Cells(counter, "C") = com_salt_batch(3)
End If

Thanks & regards
Ram