Function to Extract first name

To make a Function in Excel VBA Macro to Extract First Name

Excel VBA में एक फंक्शन बनाना है, जो First Name या word को किसी सेल से निकाले.

 

When we make a macro then we type Sub then macro name like copydata, example given below.

जब हम Macro बनातें हैं, तो हम Sub से स्टार्ट करते हैं, फिर मैक्रो का नाम देते हैं. उदाहरण के लिए

Sub copydata()
End Sub
But when we make any function in excel vba then we need to type Function and Function name. Like :- Function make_Total.
लेकिन जब हम Function बनाते हैं तो हम Function से स्टार्ट करते हैं, फिर फंक्शन का नाम देते हैं.
From below code we can extract First Name, just like a function in excel.
निचे लिखे VBA Function से हम cell से first name निकाल सकते हैं, यह ठीक उसी तरह काम करेगा जिस तरह एक्सेल का function काम करता हैं.
Function FIRST_NAME(X As String)
space_position = InStr(X, ” “)
FIRST_NAME = Left(X, space_position – 1)
End Function

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *