Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

VBA Function Returns Input Parameters instead of Output Valu

0

I used one of the tutorials on this site to set up a module with the following UDF...

Function Get_Word(input_data, delimiter, word)
    
    word = word - 1
  
       another_name = Split(input_data, delimiter)

        Get_Word = another_name(word)

End Function

In my worksheet, the following was returned in the cell after calling the Function.

=Get_Word(C5," ",2)

Why is it not returning the value?

Answer
Discuss

Answers

0

Hi QuickDraw and welcome to the Forum

I can guess two causes- 1) cell C5 does not contain two or more words separated by a single space or 2) you have macros disabled- the default for Excel recently.

(Please note that I'm on my phone at present so can't run macros but might revise the answer if they don't work). 

Discuss

Discussion

Thanks for replying. Turns out the problem was caused by the cell format being set to Text. Once I set it to General, it worked fine.
QuickDraw Nov 7, '22 at 1:15 pm
Great, glad you got it sorted. 
John_Ru (rep: 4312) Nov 7, '22 at 1:48 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login