J
Jan Kronsell
I have this function that works nicely:
Function Saml() As String
Dim Navn As String
Navn = ""
For Each c In ActiveSheet.Range("B1:B100).Cells
If IsEmpty(c.Value) Then Exit For
Navn = Navn & c.Value & ";"
Next c
Saml = Navn
End Function
Now I try to make my Function dynamic by changing it to
Function Saml(Omr As Range) As String
Dim Navn As String
Navn = ""
For Each c In ActiveSheet.Range(Omr).Cells
If IsEmpty(c.Value) Then Exit For
Navn = Navn & c.Value & ";"
Next c
Saml = Navn
End Function
But now it returns a #Value! code in stead of the result. What do I do wrong
here?
Jan
Function Saml() As String
Dim Navn As String
Navn = ""
For Each c In ActiveSheet.Range("B1:B100).Cells
If IsEmpty(c.Value) Then Exit For
Navn = Navn & c.Value & ";"
Next c
Saml = Navn
End Function
Now I try to make my Function dynamic by changing it to
Function Saml(Omr As Range) As String
Dim Navn As String
Navn = ""
For Each c In ActiveSheet.Range(Omr).Cells
If IsEmpty(c.Value) Then Exit For
Navn = Navn & c.Value & ";"
Next c
Saml = Navn
End Function
But now it returns a #Value! code in stead of the result. What do I do wrong
here?
Jan