Another macro recording restructure help please

Andries

Board Regular
Joined
Feb 3, 2011
Messages
127
Hi

Ok now I have added this code:
but it does not work properly because it is suppose to loop through. When I hit the process button the first time around it should run this code in cloumn B and the values should stay there, and when I hit the process button again it should do exactly the same code as in column B but only in column C and so on. Each column has a date heading and based on what the date is on "data2" it should run the code only in that specific column

Sheets("ALL").Select
Range("b49").Select
ActiveCell.FormulaR1C1 = _ "=IFERROR(IF(AND(R47C2=data2!R1C8,data2!R1C9=1)*TRUE,VLOOKUP(RC1,data2!R2C1:R4000C15,2,0),""""),""NR"")"
Sheets("ALL").Range("b49").copy Destination:=Range("b50:b105,b108:b126")
Range("B49:B105").Select
Selection.copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B108:B126").Select
Selection.copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False



Range("C49").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(IF(AND(R47C2=data2!R1C8,data2!R1C9=2)*TRUE,VLOOKUP(RC1,data2!R2C1:R4000C15,2,0),""""),""NR"")"
Sheets("ALL").Range("c49").copy Destination:=Range("c50:c105,c108:c126")
Range("c49:c105").Select
Selection.copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("c108:c126").Select
Selection.copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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