I am trying to make a simple code using split
, but there are some errors that I am not able to solve .. in% with% with asterisk VBA informs me that if
is out of range ..
Sub Getinstrument()
Dim instrument As String
Dim splitinstrument() As String
Dim i As Integer
Dim removespax As Integer
Dim tam As Integer
removespax = -1
'Set instrument = Range(ActiveCell.Row, B)
instrument = Range("E3")
splitinstrument() = Split(instrument)
tam = Len(instrument) - 1
For i = 0 To tam
**If splitinstrument(i) <> "" And "x" Then
removespax = removespax + 1
splitinstrument(removespax) = splitinstrument(i)
End If
Next
ReDim Preserve splitinstrument(removespax)
MsgBox splitinstrument()
End Sub