mdavid800
08-07-2011, 06:12 AM
Hi there
I have the VBA code which is located below to average every 12 cells in my worksheet titled “clear”.
Sub Average_2()
Dim i As Long
For i = 35 To 8663 Step 12
Range("BT" & Rows.Count).End(xlUp).Offset(1).Value = WorksheetFunction.Average(Range("BS" & i).Resize(12))
Next i
End Sub
However I would like to put a button on another sheet were the user inputs are this seems to be causing me problems, can anybody suggest how I would change the code above so that the click button will work as it does when the button is placed on the “clear” worksheet. I have tried
Sub Average_2()
Dim i As Long
For i = 35 To 8663 Step 12
Range("BT" & Rows.Count).End(xlUp).Offset(1).Value = Worksheets("Clear"). WorksheetFunction.Average(Range("BS" & i).Resize(12))
Next i
End Sub
To no avail
Thank you in advance
David
I have the VBA code which is located below to average every 12 cells in my worksheet titled “clear”.
Sub Average_2()
Dim i As Long
For i = 35 To 8663 Step 12
Range("BT" & Rows.Count).End(xlUp).Offset(1).Value = WorksheetFunction.Average(Range("BS" & i).Resize(12))
Next i
End Sub
However I would like to put a button on another sheet were the user inputs are this seems to be causing me problems, can anybody suggest how I would change the code above so that the click button will work as it does when the button is placed on the “clear” worksheet. I have tried
Sub Average_2()
Dim i As Long
For i = 35 To 8663 Step 12
Range("BT" & Rows.Count).End(xlUp).Offset(1).Value = Worksheets("Clear"). WorksheetFunction.Average(Range("BS" & i).Resize(12))
Next i
End Sub
To no avail
Thank you in advance
David