Concatenate with Underscore in formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All.....

I am trying to use VBA to place a formula in a cell that is a concatenation
of two cells using an underscore between them. The formula works fine when
used on the sheet, but VBA balks at the underscores.......is there some
special combination of characters to allow the underscore.....

My code reads something like this

formula = "=A1&"_"&B1"

Any help would be appreciated,
Vaya con Dios,
Chuck, CABGx3
 
I think you problem is not with the underscore, but trying to embed double
quotes within you string

formula = "=A1&""_""&B1"
? formula
=A1&"_"&B1



so double your double quotes when used within a string
 
Cool Tom.........thanks many bunches, that solved the problem. My actual
formula was a long IF-VLOOKUP string and also included a null "" thing that
needed the same treatment.

I much appreciate your help......

Vaya con Dios,
Chuck, CABGx3
 
Back
Top