Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Group,
I am trying to automate this using a macro. I am trying to populate the values of set of cells with a single click of a command button. I tried FOR loop and all I get is just errors. Could someone please help me to write a macro for the following: Case 1: 'Max of interval 18 Formula in cell D1 =max(E2:E19) Formula in cell D2 =max(E20:E37) Formula in cell D3 =max(E38:E55) ...... Formula in cell D117...... Case2: 'Max of interval 18 - Mid value of interval 18 Formula in cell G1 =(max(F2:F19) - F10) Formula in cell G2 =max(F20:F37) - F28) Formula in cell G3 =max(F38:F55) - F46) ...... Formula in cell D117..... Any help would be much appreciated. Thanks, Kevin |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this,
Right click your sheet tab, view code and paste this in and run it. If you want the step to be variable you could do that with an input box to get the step value or read it from a worksheet cell. Sub FillumUp() myrow = 1 For X = 2 To 5000 Step 18 Range("D" & myrow).Formula = "=Max(E" & X & ":E" & X + 17 & ")" Range("G" & myrow).Formula = "=Max(F" & X & ":g" & X + 17 & ")-F" & X + 8 myrow = myrow + 1 If myrow = 118 Then Exit Sub Next End Sub Mike " wrote: Hello Group, I am trying to automate this using a macro. I am trying to populate the values of set of cells with a single click of a command button. I tried FOR loop and all I get is just errors. Could someone please help me to write a macro for the following: Case 1: 'Max of interval 18 Formula in cell D1 =max(E2:E19) Formula in cell D2 =max(E20:E37) Formula in cell D3 =max(E38:E55) ...... Formula in cell D117...... Case2: 'Max of interval 18 - Mid value of interval 18 Formula in cell G1 =(max(F2:F19) - F10) Formula in cell G2 =max(F20:F37) - F28) Formula in cell G3 =max(F38:F55) - F46) ...... Formula in cell D117..... Any help would be much appreciated. Thanks, Kevin |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OOPS,
Typo. Try this instead Sub FillumUp() myrow = 1 For X = 2 To 5000 Step 18 Range("D" & myrow).Formula = "=Max(E" & X & ":E" & X + 17 & ")" Range("G" & myrow).Formula = "=Max(F" & X & ":F" & X + 17 & ")-F" & X + 8 myrow = myrow + 1 If myrow = 118 Then Exit Sub Next End Sub "Mike H" wrote: Try this, Right click your sheet tab, view code and paste this in and run it. If you want the step to be variable you could do that with an input box to get the step value or read it from a worksheet cell. Sub FillumUp() myrow = 1 For X = 2 To 5000 Step 18 Range("D" & myrow).Formula = "=Max(E" & X & ":E" & X + 17 & ")" Range("G" & myrow).Formula = "=Max(F" & X & ":g" & X + 17 & ")-F" & X + 8 myrow = myrow + 1 If myrow = 118 Then Exit Sub Next End Sub Mike " wrote: Hello Group, I am trying to automate this using a macro. I am trying to populate the values of set of cells with a single click of a command button. I tried FOR loop and all I get is just errors. Could someone please help me to write a macro for the following: Case 1: 'Max of interval 18 Formula in cell D1 =max(E2:E19) Formula in cell D2 =max(E20:E37) Formula in cell D3 =max(E38:E55) ...... Formula in cell D117...... Case2: 'Max of interval 18 - Mid value of interval 18 Formula in cell G1 =(max(F2:F19) - F10) Formula in cell G2 =max(F20:F37) - F28) Formula in cell G3 =max(F38:F55) - F46) ...... Formula in cell D117..... Any help would be much appreciated. Thanks, Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Recurring date formula | Excel Worksheet Functions | |||
How to build effective IF Statement for recurring value in cells....sensitivity analysis | Excel Discussion (Misc queries) | |||
Counting recurring cells | Excel Programming | |||
Recurring Excel Formula error - multiple users affected! | Excel Discussion (Misc queries) | |||
Formula to compare two lists and separate non-recurring items? | Excel Worksheet Functions |