Macros in Excel 2007

liquidblack

New Member
Joined
Mar 17, 2009
Messages
2
Hello, I am new to the macro writing world so any assistance would be much appreciated. I have two worksheets in excel. The first is a summary worksheet that has formulas that average some totals on the other worksheet, which happens to be a template that is unpopulated with data. I need a macro that will automatically update the average formula's on the summary sheet every time a new blank template worksheet is created. I initially tried this by recording the macro, however it didn't work and I don't know a thing about visual basic. Please help
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Just wanted to add some more info as this thread has got some looks but no replies. I have copied and pasted the macro that I am try to tweak below. The macro creates a new worksheet, however everytime I execute the macro, it doesn't add the figures from my new templated worksheet to the cells in my summary sheet. Please help?






Sub Newworksheet()
'
' Newworksheet Macro
' Adds a new worksheet that automatically feeds the summary sheet
'
' Keyboard Shortcut: Ctrl+a
'
Cells.Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("Summary").Select
Range("M10").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[19]C,'AAR (SFC Smith)'!R[19]C,Sheet1!R[19]C)"
Range("M15").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[47]C,'AAR (SFC Smith)'!R[47]C,Sheet1!R[47]C)"
Range("M21").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[75]C,'AAR (SFC Smith)'!R[75]C,Sheet1!R[75]C)"
Range("M23").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[87]C,'AAR (SFC Smith)'!R[87]C,Sheet1!R[87]C)"
Range("M25").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[100]C,'AAR (SFC Smith)'!R[100]C,Sheet1!R[100]C)"
Range("M31").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Smith)'!R[140]C,'AAR (SFC Doe)'!R[140]C,Sheet1!R[140]C)"
Range("L41").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Smith)'!R[189]C,'AAR (SFC Doe)'!R[189]C,Sheet1!R[189]C)"
Range("L42").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[189]C,'AAR (SFC Smith)'!R[189]C,Sheet1!R[189]C)"
Range("L43").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Smith)'!R[189]C,'AAR (SFC Doe)'!R[189]C,Sheet1!R[189]C)"
Range("L44").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Doe)'!R[189]C,'AAR (SFC Smith)'!R[189]C,Sheet1!R[189]C)"
Range("L45").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE('AAR (SFC Smith)'!R[189]C,'AAR (SFC Doe)'!R[189]C,Sheet1!R[189]C)"
Range("L46").Select
Sheets("Sheet1").Select
Range("N213").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,236
Messages
6,054,300
Members
444,715
Latest member
GlitchHawk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top