Panda
New Member
- Joined
- Feb 19, 2021
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi!
One of my macros works well when the users run it, except for one. That user gets Run-time error 1004 and this is where it highlights when clicking debug:
Range("CZ2:CZ" & OpenOrdersRows).FormulaR1C1 = "=IF(OR(NOT(ISERROR(MATCH(@C36,Mapping!C4,0))),@C2="""",ISERROR(MATCH(VALUE(@C46),Mapping!C3,0)),NOT(ISERROR(MATCH(VALUE(@C50:C[-54]),Mapping!C32,0)))),""Delete"",""Keep"")"
Do you think is because I am using @C36 instead of the range? Thank you in advance!
The complete code (up to where the error is):
Sub Update_Outbounds()
Sheets("Control").Select
'Count Open Orders rows
OpenOrdersRows = Sheets("Open_Orders").Range("A1").Offset(Rows.Count - 1, 0).End(xlUp).Row
'Stop the macro if Open Orders is empty
If OpenOrdersRows = 1 Then
MsgBox "The Open Orders sheet is empty. Please update this and re-run this macro"
Exit Sub
Else
End If
'Update button
ActiveSheet.Shapes("Button 4").Select
Selection.Characters.Text = "Update Outbound Delivery Numbers " & Chr(10) & Now
'Remove any filters in the Open_Orders tab
Sheets("Open_Orders").Select
ActiveSheet.AutoFilterMode = False
'Determine which rows should be deleted e.g. not shipping from UK, doesn't have an outboud number or isn't an EU market
Range("CZ1").FormulaR1C1 = "Delete?"
Range("CZ2:CZ" & OpenOrdersRows).FormulaR1C1 = "=IF(OR(NOT(ISERROR(MATCH(@C36,Mapping!C4,0))),@C2="""",ISERROR(MATCH(VALUE(@C46),Mapping!C3,0)),NOT(ISERROR(MATCH(VALUE(@C50:C[-54]),Mapping!C32,0)))),""Delete"",""Keep"")"
Range("CZ2:CZ" & OpenOrdersRows) = Range("CZ2:CZ" & OpenOrdersRows).Value
One of my macros works well when the users run it, except for one. That user gets Run-time error 1004 and this is where it highlights when clicking debug:
Range("CZ2:CZ" & OpenOrdersRows).FormulaR1C1 = "=IF(OR(NOT(ISERROR(MATCH(@C36,Mapping!C4,0))),@C2="""",ISERROR(MATCH(VALUE(@C46),Mapping!C3,0)),NOT(ISERROR(MATCH(VALUE(@C50:C[-54]),Mapping!C32,0)))),""Delete"",""Keep"")"
Do you think is because I am using @C36 instead of the range? Thank you in advance!
The complete code (up to where the error is):
Sub Update_Outbounds()
Sheets("Control").Select
'Count Open Orders rows
OpenOrdersRows = Sheets("Open_Orders").Range("A1").Offset(Rows.Count - 1, 0).End(xlUp).Row
'Stop the macro if Open Orders is empty
If OpenOrdersRows = 1 Then
MsgBox "The Open Orders sheet is empty. Please update this and re-run this macro"
Exit Sub
Else
End If
'Update button
ActiveSheet.Shapes("Button 4").Select
Selection.Characters.Text = "Update Outbound Delivery Numbers " & Chr(10) & Now
'Remove any filters in the Open_Orders tab
Sheets("Open_Orders").Select
ActiveSheet.AutoFilterMode = False
'Determine which rows should be deleted e.g. not shipping from UK, doesn't have an outboud number or isn't an EU market
Range("CZ1").FormulaR1C1 = "Delete?"
Range("CZ2:CZ" & OpenOrdersRows).FormulaR1C1 = "=IF(OR(NOT(ISERROR(MATCH(@C36,Mapping!C4,0))),@C2="""",ISERROR(MATCH(VALUE(@C46),Mapping!C3,0)),NOT(ISERROR(MATCH(VALUE(@C50:C[-54]),Mapping!C32,0)))),""Delete"",""Keep"")"
Range("CZ2:CZ" & OpenOrdersRows) = Range("CZ2:CZ" & OpenOrdersRows).Value