Results 1 to 2 of 2
  1. #1
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172

    Deleting column from chart with NULL value using VBA

    Hi,



    I have a column chart based on a query. My query by design holds NULL values, so that I can display a list of names in the chart legend, even if there is no data against a name.

    However, now of course my chart has an empty column on the left hand side.

    Is there anyway of writing VBA to delete this empty column? I am no good with VBA, but thinking of an IfThenElse, i.e. If column Is Null Then delete it, Else display column?

    I feel as though this must be possible, but have no idea where to start.

    Thanks.

  2. #2
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Ok, I have found this code, but it is obviously for Excel. If anyone is able to help me convert it to Access, I'd really appreciate it:

    Dim isEmptySeries As Boolean
    For Series = 1 To .SeriesCollection.Count
    .SeriesCollection(Series).ApplyDataLabels Type:=xlDataLabelsShowValue, AutoText:=True, LegendKey:=False
    isEmptySeries = True

    For i = 1 To .SeriesCollection(Series).points.Count
    If .SeriesCollection(Series).points(i).DataLabel.Text = 0 Then
    .SeriesCollection(Series).points(i).HasDataLabel = False
    Else
    isEmptySeries = False
    .SeriesCollection(Series).points(i).DataLabel.Font .Size = 16
    End If
    Next i

    If isEmptySeries Then
    .SeriesCollection(Series).Delete
    End If

    Next Datenreihe

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Left Hand column in chart empty
    By Kirsti in forum Reports
    Replies: 10
    Last Post: 03-20-2012, 01:41 PM
  2. Add Error bars to column chart
    By kzimm14 in forum Reports
    Replies: 7
    Last Post: 02-02-2012, 01:09 PM
  3. Replies: 11
    Last Post: 12-14-2010, 01:25 PM
  4. Setting NOT NULL for an column
    By cwwaicw311 in forum Forms
    Replies: 1
    Last Post: 02-21-2010, 10:30 PM
  5. Column Chart Issue
    By Sim_ in forum Access
    Replies: 0
    Last Post: 10-26-2009, 01:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums