VBA Excel Function

Associate
Joined
25 Feb 2007
Posts
905
Location
Midlands
Hi all,

I'm after a function that will accept a range of cells, and then wrap the contents of each cell with single quotes before concatenting everything separated by a comma. A parameter to determine whether numerics are wrapped in quotes or not would be a bonus!

Anyone know of anything, or be so kind to write me something? :D

Thanks!
 
Does it need to be VBA for any reason? Only I reckon formulae can achieve this:

bxqzF.jpg


There's probably a slicker way to do it, but I think it does the job?

Column F shows a ' if there's a numeric value in column A that starts with a ' in column C.
 
Hi mate,

Thanks for your reply. That's pretty much how I'm doing it currently, but the number of things I'm joining can get a little bit messy.

CONCATENATE makes things a bit neater (rather than using & to join) but it doesn't accept ranges, and can only handle 30-odd bits of data, so I'm ending up doing a few to cover all of my cells, and then doing another to join the results!

Hence why I thought VBA could be of use, but my skills are a bit rusty!
 
Back
Top Bottom