So have the basic VBA but its not working. Currently its highlighting the last five lines and saying that its expecting an end of statement. Any help would be greatly appreciated. Thanks
Sheets("Sheet3").Select
' Select the cell in the upper-left corner of the chart.
Range("b2").Select
' Select the current range of data. This line of code assumes that
' the current region of cells is contiguous - without empty rows
' or columns.
Selection.CurrentRegion.Select
' Assign the address of the selected range of cells to a variable.
myrange = Selection.Address
' Assign the name of the active sheet to a variable. This line is
' used in order to allow a chart to be created on a separate chart
' sheet.
mysheetname = ActiveSheet.Name
' Add a chart to the active sheet.
' ActiveSheet.ChartObjects.Add(125.25, 60, 301.5, 155.25).Select
' To create a chart on a separate chart sheet, remark out the
' previous line, and substitute the next line for the one above.
Charts.Add
Application.CutCopyMode = False
ActiveChart.ChartType = x1ColumnClustered
ActiveChart.SetSourceData Source:=Sheets(mysheetname).Range(myrange), _
PlotBy:=xlColumns, _
CategoryLabels:=1, SeriesLabels:=1 HasLegend:=0,
Title:="", CategoryTitle:="", _
ValueTitle:="", ExtraTitle:=""
Just to clarify trying to get it to make a chart with whatever data is in the sheet.
Sheets("Sheet3").Select
' Select the cell in the upper-left corner of the chart.
Range("b2").Select
' Select the current range of data. This line of code assumes that
' the current region of cells is contiguous - without empty rows
' or columns.
Selection.CurrentRegion.Select
' Assign the address of the selected range of cells to a variable.
myrange = Selection.Address
' Assign the name of the active sheet to a variable. This line is
' used in order to allow a chart to be created on a separate chart
' sheet.
mysheetname = ActiveSheet.Name
' Add a chart to the active sheet.
' ActiveSheet.ChartObjects.Add(125.25, 60, 301.5, 155.25).Select
' To create a chart on a separate chart sheet, remark out the
' previous line, and substitute the next line for the one above.
Charts.Add
Application.CutCopyMode = False
ActiveChart.ChartType = x1ColumnClustered
ActiveChart.SetSourceData Source:=Sheets(mysheetname).Range(myrange), _
PlotBy:=xlColumns, _
CategoryLabels:=1, SeriesLabels:=1 HasLegend:=0,
Title:="", CategoryTitle:="", _
ValueTitle:="", ExtraTitle:=""
Just to clarify trying to get it to make a chart with whatever data is in the sheet.