Friday 25 October 2013

Excel Macro to extract the part of cell value or string


Sub extractString()
'Excel macro to get the part of string
'you can use below functions to extract the part of the string

MsgBox Left("Lalu Prasad", 4) 'get 4 characters from left side of string
'output - Lalu
'Left function will get the specified number of characters from left side of the string

MsgBox Right("Lalu Prasad", 6) 'get 6 characters from the right side of the string
'Right function will get the specified number of characters from right side of the string
'Output - Prasad

MsgBox Mid("Lalu Prasad", 6, 6) 'get 6 characters starting from index 6
'Mid function is used to get the fixed length portion of string starting from given position or index
'Output - Prasad
End Sub

What do you think on above excel macro topic? Please provide your input, comments, questions on excel macro. I will try to reply as soon as possible. I value your opinion on Excel Macros.

No comments:

Post a Comment

Popular Posts

Search This Blog