0

I want to check whether a cell in another worksheet is empty and then insert a formula accordingly.

My attempt looks like:

Range("IN47").Select
    If IsEmpty(Worksheets(1).Range("A2").value) = True Then
    Range("IN47").Formula = "=Concatenate('Name 1'!B2; " @ "; 'Name 1'!C2)"
    End If

I get invalid character the error message. If I directly paste the formula into the cell then it works as it should.

What am I doing wrong?

Rene
  • 13
  • 3
  • 3
    The common 2 problems (can be found hundred times on SO) when writing formulas with VBA: a) You need to specify your formula in US-EN format which means that you need to use comma as parameter separator. b) If you want to put a quote into the formula, you need to double it so the VBA runtime knows that your string is not ending. – FunThomas Sep 15 '22 at 11:53
  • Thanks a lot. I searched maybe 10 websites and just couldn't find the answer. Now it finally works – Rene Sep 16 '22 at 03:00

0 Answers0