Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Loop to Paste Array
I currently have a macro that copy pastes a formula based on a predetermined
cell range. Is there a way to create a loop that will find cells that have values in Col B and Col C and paste the formula in Col N. Macro Example: (Replace "=Range("N2:N100)) with loop. ActiveCell.FormulaR1C1 = _ "=IF(RC13="""","""",SUMIF(R2C2:R500C2,R2C13:R100C1 3,R2C3:R500C3))" Range("N2").Select Selection.AutoFill Destination:=Range("N2:N100"), Type:=xlFillDefault Range("N2:N100").Select ActiveWindow.ScrollRow = 1 Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Loop to Paste Array
dim myCell as range
with activesheet for each mycell in .range("n2:n100") if isempty(.cells(mycell.row,"B")) _ and isempty(.cells(mycell.row,"C")) then 'both empty, do nothing else mycell.formular1c1 = "yourformulahere" end if next mycell end with === I wasn't sure if both B and C had to be empty or just one (or the other). Change that AND to Or if you want. Nate wrote: I currently have a macro that copy pastes a formula based on a predetermined cell range. Is there a way to create a loop that will find cells that have values in Col B and Col C and paste the formula in Col N. Macro Example: (Replace "=Range("N2:N100)) with loop. ActiveCell.FormulaR1C1 = _ "=IF(RC13="""","""",SUMIF(R2C2:R500C2,R2C13:R100C1 3,R2C3:R500C3))" Range("N2").Select Selection.AutoFill Destination:=Range("N2:N100"), Type:=xlFillDefault Range("N2:N100").Select ActiveWindow.ScrollRow = 1 Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with creating a loop | Setting up and Configuration of Excel | |||
creating a loop | Excel Discussion (Misc queries) | |||
Need Help With Creating A Loop | Excel Programming | |||
Excel VBA, Loop, array, cut and paste | Excel Programming | |||
Creating a For Loop | Excel Programming |