LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating tables using AutoFilter in Macro

Hello,

I'm having a weird problem. I've created a Macro which uses
AutoFilter to cycle through the categories. I'd like to create a
table for each category. The macro works, in that it changes the
category and creates a chart for each, but the values remain the
same. I tried recording a couple of different ways...unselecting and
reselecting the "new" data set, but it doesn't seem to matter. The
only thing that I can think of is that I've selected the columns, not
the invdividual cells. Unfortunately, I don't know how many records
are going to be in each category, so I don't believe that I can use
relative or absolute cell references. Any ideas or suggestions would
be greatly appreciated. (I've included a sample of the code below)

Lisa

Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Auto & Truck Repair"
Columns("B:C").Select
Charts.Add
ActiveChart.ChartType = xlBarClustered
ActiveChart.SetSourceData
Source:=Sheets("Format").Range("B1:C821"), PlotBy _
:=xlColumns
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:= _
"Auto & Truck Repair"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Cost to Rev %"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Auto &
Truck Repair"
End With
ActiveChart.HasLegend = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
...
ActiveChart.PlotArea.Select
Selection.Top = 32
Selection.Height = 582
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels AutoText:=True,
LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False,
ShowValue:=True, _
ShowPercentage:=False, ShowBubbleSize:=False
Sheets("Format").Select
Selection.AutoFilter Field:=1, Criteria1:="Auto Allowance"
Columns("B:C").Select
Charts.Add
ActiveChart.ChartType = xlBarClustered
ActiveChart.SetSourceData
Source:=Sheets("Format").Range("B1:C821"), PlotBy _
:=xlColumns
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:="Auto
Allowance"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Cost to Rev %"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Auto
Allowance"
End With

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a quote looking up from tables andyell Excel Worksheet Functions 1 June 12th 06 01:21 AM
Creating tables Derek Charts and Charting in Excel 0 December 19th 05 04:55 PM
Creating Pivot Tables with macro Problem Linda Excel Programming 4 November 2nd 05 07:19 PM
Creating Pivot Tables inside a Macro farrell77 Excel Programming 4 February 18th 05 09:54 PM
creating autofilter and using them thanks VBA Maileen[_3_] Excel Programming 3 January 2nd 05 11:11 PM


All times are GMT +1. The time now is 09:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"