Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
HELP to correc this macro
I got an error: (Run-time error '1004': Application-defined or object-defined
error). Thanks, Sub Avg3Row() Dim OutputRow As Integer OutputRow = 1 For Row = Selection.Row To ActiveSheet.UsedRange.Rows.Count Step 30 Worksheets("Output").Cells(OutputRow, 1).Formula = "=average(Input!B" & Row - 3 & ":B" & Row & ")" OutputRow = OutputRow + 1 Next Row End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
HELP to correc this macro
It's better not to use Row as the count variable, given that this a reserved
word - make it myRow or some-such, and DIM it at the beginning of the macro. Also, if you have selected cells on rows 1 to 3, then you will be trying to set up an average for cells B-2, B-1 or B0 - such cells don't exist !! Hope this helps. Pete "bioyyy" wrote in message ... I got an error: (Run-time error '1004': Application-defined or object-defined error). Thanks, Sub Avg3Row() Dim OutputRow As Integer OutputRow = 1 For Row = Selection.Row To ActiveSheet.UsedRange.Rows.Count Step 30 Worksheets("Output").Cells(OutputRow, 1).Formula = "=average(Input!B" & Row - 3 & ":B" & Row & ")" OutputRow = OutputRow + 1 Next Row End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Windows cannot find ___.xls. Make sure you typed the name correc | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
How X-ax reflect correc time interval when don't have all points | Charts and Charting in Excel |