Reputation: 23
Can some body help me with the reason why below code is returning "sub or function not defined" when I attempt to run a module.
Sub Tokenize()
Dim txt As String
Dim i As Integer
Dim FullName As Variant
For Counter = 1 To 300
Set curCell = Worksheet("Sheet1").Cells(Counter, 1)
txt = curCell.Value
FullName = Split(txt, " ")
For i = 0 To UBound(FullName)
Cells(Counter, i + 1).Value = FullName(i)
Next i
Next Counter
End Sub
Upvotes: 0
Views: 2675
Reputation: 10628
I suspect the error is in this line:
Set curCell = Worksheet("Sheet1").Cells(Counter, 1)
^^^
You should replace Worksheet
with Worksheets
(notice the additional s
).
Upvotes: 4