Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Execution speed for UDF

Hi NG,

I'm not a very advanced user of vba stuff.

I have a string that contains several field values. I made below UDF in the
VBE. The function allows me to enter 3 arguments to the function; cell with
the string to be examined, the delimter eg. "," or ";" and finally the field
number to output.

My function looks like this

Public Function SplitString(myCell As String, myDelimiter As String, myField
As Long) As Variant

Dim myArr As Variant
Dim myField2 As Long
myField2 = myField - 1 'vba assign 0 to the first field, more natural to
use 1 to represent the first field

myArr = VBA.Split(myCell, myDelimiter) 'adding inputcell content to
array and using split function to seperate each entry
SplitString = myArr(myField2) 'selecting the field to output

End Function

The function runs fairly slowly, can it be improve somehow?
Also in case there is no output the function currently return '0' in the
cell. Can the function be modified so that it returns nothing in case there
is nothing in the field?

Comments and suggestions are warmly welcome
- Chr


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you speed UP drag speed? Ryan W Excel Discussion (Misc queries) 1 October 24th 05 06:09 PM
function execution matty_g Excel Worksheet Functions 2 June 9th 05 12:05 AM
Execution Error Craig[_8_] Excel Programming 0 September 7th 04 05:12 PM
Extremely Slow VBA Execution Speed Joe Adams[_3_] Excel Programming 3 May 15th 04 01:23 AM
MACRO execution speed ericd Excel Programming 3 March 2nd 04 03:06 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"