LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Function results in #NAME?


In working on a concatenation problem, I have come to realize that I
probably have use my own function to cycle through cells and
concatenate them. Below is the code I copied from this site and
modified for my own use. Ignoring for the moment that there are
probably problems with the code, I can't seem to get my spreadsheet to
recognize the function; every time I set my formula to
"=GlueText(E20:E30, A20:A30, "B")", Excel returns with "#NAME?". I
haven't used VBA in Excel before, so I know I'm missing something
really simple.


Code:
--------------------
Public Function GlueText(srch As Variant, rslt As Variant, srchstr As String, Optional delimiter As String = vbNullString) As String

Dim rArea, rCell, r&, c&, s$
If TypeOf data Is Range Then
For Each rArea In data.Areas
For Each rCell In rArea.Cells
'Note: for ranges the (formatted) Text property is used
If rCell.Text = srchstr Then s = s & delimiter & rCell.Text
Next
Next
Else
s = rslt
End If
TheEnd:
GlueText = Mid(s, 1 + Len(delimiter))
End Function
--------------------


--
sunfish62
------------------------------------------------------------------------
sunfish62's Profile: http://www.excelforum.com/member.php...o&userid=24541
View this thread: http://www.excelforum.com/showthread...hreadid=382013

 
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
MID function results Maria[_4_] Excel Worksheet Functions 4 October 22nd 09 04:25 PM
entering function results into another function excelhurtsme Excel Discussion (Misc queries) 10 December 11th 08 10:10 PM
how do you write format results of a function within a function? sangee Excel Worksheet Functions 3 June 14th 07 12:45 AM
extra results in the MAX function jeroen Excel Worksheet Functions 3 May 19th 05 02:29 PM
Using function results as parameters in another function Steve Haack Excel Worksheet Functions 1 April 24th 05 11:39 PM


All times are GMT +1. The time now is 01:38 PM.

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

About Us

"It's about Microsoft Excel"