I'm new to VBA and am running some code but getting a runtime error for the following, can anybody help.
Option Explicit
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 14/07/2010 by mfoster
'
Dim ws As Worksheets
For Each ws In Worksheets
Range("A1:C16").Select
Selection.AutoFormat Format:=xlRangeAutoFormatSimple, Number:=True, Font _
:=True, Alignment:=True, Border:=True, Pattern:=True, Width:=True
Range("A1:C15").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=ws.Range("A1:C15"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:=ws.Name '"2002"
Next
End Sub
Option Explicit
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 14/07/2010 by mfoster
'
Dim ws As Worksheets
For Each ws In Worksheets
Range("A1:C16").Select
Selection.AutoFormat Format:=xlRangeAutoFormatSimple, Number:=True, Font _
:=True, Alignment:=True, Border:=True, Pattern:=True, Width:=True
Range("A1:C15").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=ws.Range("A1:C15"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:=ws.Name '"2002"
Next
End Sub