i want to count the number of times a string appears in a string.
sy for example "Excel"
i thought this would work but i get an 'Object Required' when it starts
and 'CountIf' is highlighted.
Dim myfile
Dim mycount
myfile = InputBox("Enter the file name.")
mycount = WorksheetFunction.CountIf(myfile, "*Excel*")
MsgBox "The text 'Excel' appeared" & mycount & "times in the file name."
sy for example "Excel"
i thought this would work but i get an 'Object Required' when it starts
and 'CountIf' is highlighted.
Dim myfile
Dim mycount
myfile = InputBox("Enter the file name.")
mycount = WorksheetFunction.CountIf(myfile, "*Excel*")
MsgBox "The text 'Excel' appeared" & mycount & "times in the file name."