0

I just struggling out with some VBA code.

Range("N1").Select
ActiveCell.Value = "One or more emails adresses?"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=len(RC[-7])-len(substitute(RC[-7];""@"";""""))"

I just want insert to cell N2 formula: =LEN(G2)-LEN(SUBSTITUTE(G2;"@";""))

Where I had made a mistake? Thanks for any help

braX
  • 11,506
  • 5
  • 20
  • 33
Michał
  • 61
  • 8

1 Answers1

2

Try

ActiveCell.Formula = "=LEN(G2)-LEN(SUBSTITUTE(G2,""@"",""""))"

Edit: following comments

You can use the following to avoid selecting cells

Range("N1").Value = "One or more emails adresses?"
Range("N2").Formula = "=LEN(G2)-LEN(SUBSTITUTE(G2,""@"",""""))"
Super Symmetry
  • 2,837
  • 1
  • 6
  • 17