error 1004 - please help - (?) regional settings

neveu

Board Regular
Joined
Jan 27, 2009
Messages
225
hello,

i have a code line that works perfectly on my computer but when i send it to some else,
i get the error 1004 when running the macro - i have encountered a similar error and the root cause was the regional setting ( the separator in the formula was semicolon and not coma as per my computer.

any advice or support is greatly appreciate
Code:
Range("AA2:AA" & LR1).Select
    Selection.FormulaR1C1 = _
        "=IF(TODAY()-RC[-3])<7,""Blocking Notification sent ""& TODAY()-RC[-3] & "" days ago"",IF(AND(RC[-6]>0,RC[-5]<>0),IF(LEFT(RC[-4],5)=""[fax:"",""FAX EOS"",IF(LEFT(RC[-4],4)=""INVA"",""NO CONTACT"",""MAIL EOS"")),IF(AND(RC[-6]=0,LEFT(RC[-4],5)=""[fax:""),""FAX SOA"",IF(AND(RC[-6]=0,LEFT(RC[-4],4)<>""INVA""),""MAIL SOA"",""NO CONTACT"")))"
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi

Is this a typo?

"=IF(TODAY()-RC[-3])<7

as that doesn't look right. Using FormulaR1C1 should mean that you can enter the formula using commas rather than semi-colons irrespective of the regional settings
 
Upvote 0
You've also got a missing closing parentheses right at the end.

This doesn't error, but you'll need to check the formula.
Code:
Range("AA2:AA" & LR1).FormulaR1C1 = _
        "=IF(TODAY()-RC[-3]<7,""Blocking Notification sent ""& TODAY()-RC[-3] & "" days ago"",IF(AND(RC[-6]>0,RC[-5]<>0),IF(LEFT(RC[-4],5)=""[fax:"",""FAX EOS"",IF(LEFT(RC[-4],4)=""INVA"",""NO CONTACT"",""MAIL EOS"")),IF(AND(RC[-6]=0,LEFT(RC[-4],5)=""[fax:""),""FAX SOA"",IF(AND(RC[-6]=0,LEFT(RC[-4],4)<>""INVA""),""MAIL SOA"",""NO CONTACT""))))"
You could make the formula slightly shorter, in the code anyway, by using A1 notation.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top