+ Reply to Thread
Results 1 to 2 of 2

Thread: About chart with a macro

  1. #1
    alvin Kuiper
    Guest

    About chart with a macro

    Hi
    I have this in a Macro
    It works before when i try
    but now when i record a new macro it dosn't work
    Her it is
    Sheets("Ark1").Select
    Range("A1:A5,D1:D5").Select
    Range("D1").Activate
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Ark1").Range("A1:A5,D1:D5"), _
    PlotBy:=xlRows
    ActiveChart.Location Where:=xlLocationAsNewSheet
    With ActiveChart
    .HasTitle = False
    .Axes(xlCategory, xlPrimary).HasTitle = False
    .Axes(xlValue, xlPrimary).HasTitle = False
    End With


    My error is in Range("A1:A5,D1:D5").Select
    the same error if i forget
    Sheets("Ark1").Select

    Hope someone can help

    Alvin



  2. #2
    L. Howard Kittle
    Guest

    Re: About chart with a macro

    Hi Alvin,

    This worked for me. Copied your code and it worked fine. I knocked off the
    select and activate since it doesn't seem to be needed and worked the same.

    So in reality, I have offered no solution 'cept it worked for me. Or at
    least produced a chart of some kind.

    Sub ChartIt()
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Ark1") _
    .Range("A1:A5,D1:D5"), PlotBy:=xlRows
    ActiveChart.Location Where:=xlLocationAsNewSheet
    With ActiveChart
    .HasTitle = False
    .Axes(xlCategory, xlPrimary).HasTitle = False
    .Axes(xlValue, xlPrimary).HasTitle = False
    End With
    End Sub

    HTH
    Regards,
    Howard

    "alvin Kuiper" <alvinKuiper@discussions.microsoft.com> wrote in message
    news:5083A993-A0C0-4585-87CD-6E9769B60FB3@microsoft.com...
    > Hi
    > I have this in a Macro
    > It works before when i try
    > but now when i record a new macro it dosn't work
    > Her it is
    > Sheets("Ark1").Select
    > Range("A1:A5,D1:D5").Select
    > Range("D1").Activate
    > Charts.Add
    > ActiveChart.ChartType = xlColumnClustered
    > ActiveChart.SetSourceData Source:=Sheets("Ark1").Range("A1:A5,D1:D5"),
    > _
    > PlotBy:=xlRows
    > ActiveChart.Location Where:=xlLocationAsNewSheet
    > With ActiveChart
    > .HasTitle = False
    > .Axes(xlCategory, xlPrimary).HasTitle = False
    > .Axes(xlValue, xlPrimary).HasTitle = False
    > End With
    >
    >
    > My error is in Range("A1:A5,D1:D5").Select
    > the same error if i forget
    > Sheets("Ark1").Select
    >
    > Hope someone can help
    >
    > Alvin
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0