Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble with concatenate

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
Im not sure if somethigns wrong with my compiler or im just using the concatenate function wrong, but i want to simply add the word "POPULATED" at the end of the activecell
i tried activecell.value = concatenate(activecell.text, "POPULATED")

but i keep getting an error sayin concatenate is not defined, what do i do, i mean should i even use that function, is there any other way to achieve what i need, thanks!
 
Try activecell.value = activecell.text & "POPULATED"
 
Concatenate is strictly a worksheet function. There is a WorksheetFunction method, but you cannot invoke Concatenate.

Now, if you want a VBA Concatenate function, that isn't so hard to create. Pretty easy, actually.

Code:
Function Concatenate(ParamArray Strings()) As String
Dim OfThe, TheString
'Debug.Print UBound(Strings)
For Each OfThe In Strings
    'Debug.Print OfThe
    TheString = TheString & OfThe
Next
Concatenate = CStr(TheString)
End Function


From the Immediate pane:
?concatenate("first","second","third")
would return
firstsecondthird
 
oh, i never realized about worksheet functions and things like that, i thought functions could be used in every aspect, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top