Function and sub-routine during error handling in vba split

Asked By 60 points N/A Posted on -
qa-featured

During error handling in VBA split, what happens if I don’t include error handling in each and every function and sub-routine I write in a code?

SHARE
Answered By 10 points N/A #131667

Function and sub-routine during error handling in vba split

qa-featured

Hi Abriana,

As per my knowledge, while using a split function you don't really need to use error handling. You can just use the split function and you don't need to error handling in each and every step. Following example will help you:-

Sub mysplit()
Dim a As String 'declare a string
a = "hello" 'assign it a string say 'hello'
b = Split(a, "l") 'split the string on delimeter l
MsgBox b(0) 'show it on Messagebox
 
End Sub
 
This code will show word 'he' in MsgBox if you run it in excel macro.
 
MSG Box Macro Excel
 
Excel Message box
 
The above two pictures show the code and its result as well. Hope it helps you

Related Questions