upendra2206
New Member
- Joined
- Jul 17, 2016
- Messages
- 44
Hi,
I am trying to create a macro which will calculate percentile for a set of range in a row but the numbrs of cells change and hence the range needs to be dynamic. I have record the macro:
Sub mrexcel()
Range("A117").Select
ActiveCell.FormulaR1C1 = "=+PERCENTILE(R[-19]C[1]:R[-19]C[9],0.1)"
Range("A117").Select
Selection.AutoFill destination:=Range("A117:A125")
Range("A117:A125").Select
End Sub
Please note that the range here is from B98:J98. But it can be K98 or L98 or anything for that matter. I want the range to be dynamic. Please note that to select the data from B98:J98 I have used CTRL+SHIFT+RIGHT ARROW but the macro is fixing the cell address.
I am trying to create a macro which will calculate percentile for a set of range in a row but the numbrs of cells change and hence the range needs to be dynamic. I have record the macro:
Sub mrexcel()
Range("A117").Select
ActiveCell.FormulaR1C1 = "=+PERCENTILE(R[-19]C[1]:R[-19]C[9],0.1)"
Range("A117").Select
Selection.AutoFill destination:=Range("A117:A125")
Range("A117:A125").Select
End Sub
Please note that the range here is from B98:J98. But it can be K98 or L98 or anything for that matter. I want the range to be dynamic. Please note that to select the data from B98:J98 I have used CTRL+SHIFT+RIGHT ARROW but the macro is fixing the cell address.