Runtime error 1004

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

Guest

I have a problem

This is not working: ws.Cells(3, 2).Formula = "=SUMIF(B2:B7,B19,D2:D7)"

But this is working: ws.Cells(3, 2).Formula = "SUMIF(B2:B7,B19,D2:D7)"


The only difference is the "=" sign.
Can anyone help me?


I have a Norvegian Excel installation , and the Norwegian syntax is:

ws.Cells(3, 2).Formula = "=SUMMERHVIS(B2:B7;B19;D2:D7)"

but it is not working


___________
Regards
JaydDe
 
VBA is USA centric.

You'll want to use:
ws.Cells(3, 2).Formula = "=SUMIF(B2:B7,B19,D2:D7)"

This doesn't answer the question, but did you really mean to plop that formula
into B3?

I don't have a guess why you could plop the text but not the formula in that
cell.
 
I ran the following code and it worked perfectly.

Sub writecell()
Set ws = ActiveSheet
ws.Cells(3, 2).Formula = "=SUMIF(B2:B7,B19,D2:D7)"
End Sub
 
Thank you guys

When I change to English syntax in VBA it turn up in Norwegian in the
worksheet

The sentence: ws.Cells(3, 2).Formula = "=SUMIF(B2:B7,B19,D2:D7)"

Turns up as: =SUMMERHVIS(B2:B7;B19;D2:D7) in cell B3

Dave:
This only a simplified example of what I am about to do. I do not need this
in B3

--
___________
Regards
JaydDe


JayDe skrev:
 
So does this mean you found the reason why you got the 1004 error?
 
Yes

The reason was because I in VBA wrote =SUMMERHVIS (Norwegian) instead of
=SUMIF (English) and I also had to put , (comma) between the arguments
instead of ; (semicolon)
--
___________
Regards
JaydDe


Dave Peterson skrev:
 
Ahhh. Then your original post wasn't really what you tried <bg>.

You showed commas in the line that you said didn't work.
 

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