harrisont9
New Member
- Joined
- Oct 21, 2013
- Messages
- 7
Hello,
I'm trying to automatize a report. I have several huge formulas that I would like to embed into the VBA editor. Can anyone help?
This is the formula I want the Macro to enter:
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl109, width: 64"]IFERROR(IF(IF(ISNA(VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0)),VLOOKUP(A:A,'Q1188 Staged not shipped'!A:S,MATCH("SHIPPING_STATUS",'Q1188 Staged not shipped'!$A$1:$S$1,0),0),VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0))=0,"",IF(ISNA(VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0)),VLOOKUP(A:A,'Q1188 Staged not shipped'!A:S,MATCH("SHIPPING_STATUS",'Q1188 Staged not shipped'!$A$1:$S$1,0),0),VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0))),"")[/TD]
[/TR]
</tbody>[/TABLE]
This is how it looks in the VBA editor window. Everything works fine, except the section in bold.
Sheets("Formulas").Select
Range("C2").Select
Selection.Copy
Sheets("DataConsolidation").Select
Range("D2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IFERROR(IF(IF(ISNA(VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehouse Order Roundup'!R1C1:R1C19,0),0)),VLOOKUP(C[-3],'Q1188 Staged not shipped'!C[-3]:C[15],MATCH(""SHIPPING_STATUS"",'Q1188 Staged not shipped'!R1C1:R1C19,0),0),VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehous" & _
"Roundup'!R1C1:R1C19,0),0))=0,"""",IF(ISNA(VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehouse Order Roundup'!R1C1:R1C19,0),0)),VLOOKUP(C[-3],'Q1188 Staged not shipped'!C[-3]:C[15],MATCH(""SHIPPING_STATUS"",'Q1188 Staged not shipped'!R1C1:R1C19,0),0),VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_ST" & _
"1186 Warehouse Order Roundup'!R1C1:R1C19,0),0))),"""")"
I'm trying to automatize a report. I have several huge formulas that I would like to embed into the VBA editor. Can anyone help?
This is the formula I want the Macro to enter:
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl109, width: 64"]IFERROR(IF(IF(ISNA(VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0)),VLOOKUP(A:A,'Q1188 Staged not shipped'!A:S,MATCH("SHIPPING_STATUS",'Q1188 Staged not shipped'!$A$1:$S$1,0),0),VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0))=0,"",IF(ISNA(VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0)),VLOOKUP(A:A,'Q1188 Staged not shipped'!A:S,MATCH("SHIPPING_STATUS",'Q1188 Staged not shipped'!$A$1:$S$1,0),0),VLOOKUP(A:A,'Q1186 Warehouse Order Roundup'!A:S,MATCH("SHIP_STATUS",'Q1186 Warehouse Order Roundup'!$A$1:$S$1,0),0))),"")[/TD]
[/TR]
</tbody>[/TABLE]
This is how it looks in the VBA editor window. Everything works fine, except the section in bold.
Sheets("Formulas").Select
Range("C2").Select
Selection.Copy
Sheets("DataConsolidation").Select
Range("D2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IFERROR(IF(IF(ISNA(VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehouse Order Roundup'!R1C1:R1C19,0),0)),VLOOKUP(C[-3],'Q1188 Staged not shipped'!C[-3]:C[15],MATCH(""SHIPPING_STATUS"",'Q1188 Staged not shipped'!R1C1:R1C19,0),0),VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehous" & _
"Roundup'!R1C1:R1C19,0),0))=0,"""",IF(ISNA(VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_STATUS"",'Q1186 Warehouse Order Roundup'!R1C1:R1C19,0),0)),VLOOKUP(C[-3],'Q1188 Staged not shipped'!C[-3]:C[15],MATCH(""SHIPPING_STATUS"",'Q1188 Staged not shipped'!R1C1:R1C19,0),0),VLOOKUP(C[-3],'Q1186 Warehouse Order Roundup'!C[-3]:C[15],MATCH(""SHIP_ST" & _
"1186 Warehouse Order Roundup'!R1C1:R1C19,0),0))),"""")"