View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Running macros in newly created sheets

Joseph,

Something like:

Sub AverageColumnC()
Dim mySh As Worksheet
For Each mySh In Worksheets
If mySh.Name < "FINAL DATA" Then
With Worksheets("Final Data").Range("A65536").End(xlUp)(2)
.Value = mySh.Name
.Offset(0, 1).Value = Application.Average(mySh.Range("C:C"))
End With
End If
Next mySh
End Sub

HTH,
Bernie
MS Excel MVP


"joecrabtree" wrote in message
ups.com...
To All,

I have a macro that creates a series of new worksheets from a master
worksheet. I.e. it splits a set of data into different worksheets.

On each worksheet there is a list of numbers in Column C. I want to be
able to calculate the average of this list of numbers for all the new
worksheets that the first macro creates. I then want these values to be
pasted into a sheet called 'FINAL DATA' ( which already exists ) Is
this possible? and if so how?

Thanks for your help,

Regards

Joseph Crabtree