Hello all,
I have been trying to create a macro to correct the formulas in certain rows of a spreadsheet where the first cell in the row contains the text "avg," but that is not the only text in the cell. Any ideas?
Ex:
Cell A83 contains "Avg. Accounts Rec. to Earned Revenues"
and Cell A85 contains "Avg. accts. pay. & accrued exp. to revenues".
In the spreadsheet, my macro is designed to insert a new year column and carry forward the prior 9 years of data, but when I insert the new row, it messes up the formulas for the average ratios, which use data from the previous column as well as the current column.
This is the code for the formula I am using.
Range("H83").Select
Selection.AutoFill Destination:=Range("C83:H83"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C83:L83"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C85:H85"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("H85:L85"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("H94:L94"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C94:H94"), Type:=xlFillDefault
I want my macro to apply to other spreadsheets, but the average ratios are not necessarily in the above rows, so I want to generalize the macro for those spreadsheets.
I am using Excel 2013 on Windows 7, if that helps anyone.
Thank you in advance for your assistance.
I have been trying to create a macro to correct the formulas in certain rows of a spreadsheet where the first cell in the row contains the text "avg," but that is not the only text in the cell. Any ideas?
Ex:
Cell A83 contains "Avg. Accounts Rec. to Earned Revenues"
and Cell A85 contains "Avg. accts. pay. & accrued exp. to revenues".
In the spreadsheet, my macro is designed to insert a new year column and carry forward the prior 9 years of data, but when I insert the new row, it messes up the formulas for the average ratios, which use data from the previous column as well as the current column.
This is the code for the formula I am using.
Range("H83").Select
Selection.AutoFill Destination:=Range("C83:H83"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C83:L83"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C85:H85"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("H85:L85"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("H94:L94"), Type:=xlFillDefault
Selection.AutoFill Destination:=Range("C94:H94"), Type:=xlFillDefault
I want my macro to apply to other spreadsheets, but the average ratios are not necessarily in the above rows, so I want to generalize the macro for those spreadsheets.
I am using Excel 2013 on Windows 7, if that helps anyone.
Thank you in advance for your assistance.