Thread: How to define
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default How to define

Hi Robert,

The following worked for me:

'=============
Public Sub TestIt()
Dim sStr As String

sStr = Concat_Clean(Range("A1:Z1"))
MsgBox sStr

End Sub
'<<=============


---
Regards,
Norman


wrote in message
ups.com...
Okay I have a function that in development I was just hitting from the
worksheet.
So in a cell I would enter =concat_clean(A1:Z1)
------------------------------------------------
Sub Concat_Clean(Attr)
Dim C As Range
Dim S As String, V As String, X As String
S = ""
For Each C In Attr
V = C.Value
If Len(S) + Len(V) < 55 Then
If V < "" Then
If S < "" Then
S = S & " " & V
Else
S = V
End If
End If
End If
Next C
Concat_Clean = S
End Sub
------------------------------------------------

Now I want to implement this function as a call from another function.
I seem to be having problems passing a value like A1:Z1 via a variable
to in so that it all functions.
I assume it is all dependant on the type of variable it is, but I can't
seem to figure out how to do it properly.