navidadi28
New Member
- Joined
- Oct 7, 2015
- Messages
- 12
hello,new to VBA so I was hoping someone could help me out. I've looked through this website and online and can't find a solution.
The below Macro will run on different tabs so it will go through columns of different row numbers. Therefore, I need to make my SUMIF and ranges Dynamic so they will account for all the rows. I simply recorded a macro and worked through it and have hit a dead end. PLEASE someone help a guys out!
Range("X8").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC1=R7C,(RC5*RC10)/SUMIF(R8C1:R1107C1,R7C,R8C5:R1107C5),"""")"
Selection.AutoFill Destination:=Range("X8:X1107")
Range("X8:X1107").Select
Selection.AutoFill Destination:=Range("X8:AJ1107"), Type:=xlFillDefault
Range("X3").Select
ActiveCell.FormulaR1C1 = "=SUM(R[5]C:R[1104]C)"
Selection.AutoFill Destination:=Range("X3:AJ3"), Type:=xlFillDefault
Range("X3:AJ3").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
The below Macro will run on different tabs so it will go through columns of different row numbers. Therefore, I need to make my SUMIF and ranges Dynamic so they will account for all the rows. I simply recorded a macro and worked through it and have hit a dead end. PLEASE someone help a guys out!
Range("X8").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC1=R7C,(RC5*RC10)/SUMIF(R8C1:R1107C1,R7C,R8C5:R1107C5),"""")"
Selection.AutoFill Destination:=Range("X8:X1107")
Range("X8:X1107").Select
Selection.AutoFill Destination:=Range("X8:AJ1107"), Type:=xlFillDefault
Range("X3").Select
ActiveCell.FormulaR1C1 = "=SUM(R[5]C:R[1104]C)"
Selection.AutoFill Destination:=Range("X3:AJ3"), Type:=xlFillDefault
Range("X3:AJ3").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False