string within formula

  • Thread starter Thread starter sugargenius
  • Start date Start date
S

sugargenius

Right now I'm setting the formula on range like this:

oSubTotalSheet.Range("A1:A" & lngLastRow).Formula = "=A1&B1&C1&D1"

I need to insert a delimiter between each cell in the concatenation.
Something like this:

oSubTotalSheet.Range("A1:A" & lngLastRow).Formula =
"=A1&'|'&B1&'|'&C1&'|'&D1"

Is there a way I can do this with a one-liner? I suppose I could just
loop though each row and put the actual value in, but I hoped I go get
this to work.

Thanks,
Woody
 
Hi,

oSubTotalSheet.Range("A1:A" & lngLastRow).Formula =
"=A1 & ""|"" & B1 & ""|"" & C1& ""|"" & D1"

Your current formula will give a circular reference.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top