erp1022
asked on
error in vba code
Hello,
Could someone please tell me what is the problem with my vba code? When I try to debug it I keep getting that 'error 1004 application-defined or object-defined error'. I have tried different things with the syntax but I can't seem to find the issue. Thanks.
Sub Multiplier()
' Updates Multiplier column with '1' or '-1'
'
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("E2").Formula = "=IF(OR(A2=41826,A2=50529, A2=50530,A 2=51807,A2 =51828,A2= 51850,A2=5 1851,A2=51 852,A2=518 53,A2=5185 4,A2=51855 ,A2=51856, A2=51857,A 2=51858,A2 =51859,A2= 51860,A2=5 1861,A2=51 862,A2=518 63,A2=5186 4,A2=51865 ,A2=51866, A2=51899,A 2=E5184_I, A2=E5732_I ) ""-1"", ""1"")"
Range("E2").AutoFill Destination:=Range("E2:E" & lastRow), Type:=xlFillDefault
End Sub
Could someone please tell me what is the problem with my vba code? When I try to debug it I keep getting that 'error 1004 application-defined or object-defined error'. I have tried different things with the syntax but I can't seem to find the issue. Thanks.
Sub Multiplier()
' Updates Multiplier column with '1' or '-1'
'
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("E2").Formula = "=IF(OR(A2=41826,A2=50529,
Range("E2").AutoFill Destination:=Range("E2:E" & lastRow), Type:=xlFillDefault
End Sub
there are two "_I" s and one comma after the second _I
Second try with underlines
Range("E2").Formula = "=IF(OR(A2=41826,A2=50529, A2=50530,A 2=51807,A2 =51828,A2= 51850,A2=5 1851,A2=51 852,A2=518 53,A2=5185 4,A2=51855 ,A2=51856, A2=51857,A 2=51858,A2 =51859,A2= 51860,A2=5 1861,A2=51 862,A2=518 63,A2=5186 4,A2=51865 ,A2=51866, A2=51899,A 2=E5184_I,A2=E5732_I),""-1"", ""1"")"
Range("E2").Formula = "=IF(OR(A2=41826,A2=50529,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try
=IF(OR(A2=41826,A2=50529,A 2=50530,A2 =51807,A2= 51828,A2=5 1850,A2=51 851,A2=518 52,A2=5185 3,A2=51854 ,A2=51855, A2=51856,A 2=51857,A2 =51858,A2= 51859,A2=5 1860,A2=51 861,A2=518 62,A2=5186 3,A2=51864 ,A2=51865, A2=51866,A 2=51899,A2 ="E5184_I" ,A2="E5732 _I"),"-1", "1")
=IF(OR(A2=41826,A2=50529,A
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Range("E2").Formula = "=IF(OR(A2=41826,A2=50529,