Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need Help with marco and autofilter


i'm trying to use a marco to automatically filter my data so that it i
reduced to the relivant rows then create a series of graph to explan
this data but all i keep getting is "runtime error - 438." i beliv
that it has something to do with the data already being filtered. an
help would be grea

--
Bilbotubbin
-----------------------------------------------------------------------
Bilbotubbins's Profile: http://www.excelforum.com/member.php...fo&userid=2591
View this thread: http://www.excelforum.com/showthread.php?threadid=39286

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Need Help with marco and autofilter

Hi Bilbotubbins,

Post the problematic code.

---
Regards,
Norman



"Bilbotubbins"
wrote in message
news:Bilbotubbins.1t8nyt_1123157145.3895@excelforu m-nospam.com...

i'm trying to use a marco to automatically filter my data so that it is
reduced to the relivant rows then create a series of graph to explane
this data but all i keep getting is "runtime error - 438." i belive
that it has something to do with the data already being filtered. any
help would be great


--
Bilbotubbins
------------------------------------------------------------------------
Bilbotubbins's Profile:
http://www.excelforum.com/member.php...o&userid=25910
View this thread: http://www.excelforum.com/showthread...hreadid=392861



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need Help with marco and autofilter


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B21,B2:B3,D2:D3").Select
Range("D2").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceDat
Source:=Sheets("Sheet1").Range("B21,B2:B3,D2:D3")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"

End Sub
Sub testplu()
'
' testplu Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
ActiveWindow.SmallScroll Down:=27
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B41:B42,D41:D42").Select
Range("D41").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceDat
Source:=Sheets("Sheet1").Range("B41:B42,D41:D42")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
ActiveSheet.Shapes("Chart 25").IncrementLeft -165#
ActiveSheet.Shapes("Chart 25").IncrementTop -399.75
Windows("Rental Maintenance.xls").SmallScroll Down:=21
ActiveWindow.Visible = False
Windows("Rental Maintenance.xls").Activate
Selection.AutoFilter Field:=1
End Su

--
Bilbotubbin
-----------------------------------------------------------------------
Bilbotubbins's Profile: http://www.excelforum.com/member.php...fo&userid=2591
View this thread: http://www.excelforum.com/showthread.php?threadid=39286

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Need Help with marco and autofilter

Hi, Bilbotubbins,

What line is hghlighted when you get the error message?


---
Regards,
Norman



"Bilbotubbins"
wrote in message
news:Bilbotubbins.1t9tmd_1123211124.4014@excelforu m-nospam.com...

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B21,B2:B3,D2:D3").Select
Range("D2").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("B21,B2:B3,D2:D3")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"

End Sub
Sub testplu()
'
' testplu Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
ActiveWindow.SmallScroll Down:=27
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B41:B42,D41:D42").Select
Range("D41").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("B41:B42,D41:D42")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
ActiveSheet.Shapes("Chart 25").IncrementLeft -165#
ActiveSheet.Shapes("Chart 25").IncrementTop -399.75
Windows("Rental Maintenance.xls").SmallScroll Down:=21
ActiveWindow.Visible = False
Windows("Rental Maintenance.xls").Activate
Selection.AutoFilter Field:=1
End Sub


--
Bilbotubbins
------------------------------------------------------------------------
Bilbotubbins's Profile:
http://www.excelforum.com/member.php...o&userid=25910
View this thread: http://www.excelforum.com/showthread...hreadid=392861



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Need Help with marco and autofilter

Hi Bilbotubbins,

I have not attempted to reproduce your data environment, but If I guess that
your error occurs on the line:

Selection.AutoFilter Field:=1, Criteria1:="Plumber"


in the TestPlu macro (after you have run Macro1), then your error is caused
by the fact that, at that moment, the selection is a chart object (created
in Macro1). A chart object does not have an autofilter method, hence your
encountered error.

To resolve the problem, replace 'Selection' in the above line with a range
object corresponding to any cell(s) in the table to be autofiltered. For
example, if the table incldes the A1 cell then, replacing the problem line
with:

Range("A1")..AutoFilter Field:=1, Criteria1:="Plumber"

should resolve your immediate problem,

If my guess is wrong, post back indicating the line which is highlighted
when the error occurs.

---
Regards,
Norman



"Bilbotubbins"
wrote in message
news:Bilbotubbins.1t9tmd_1123211124.4014@excelforu m-nospam.com...

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B21,B2:B3,D2:D3").Select
Range("D2").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("B21,B2:B3,D2:D3")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"

End Sub
Sub testplu()
'
' testplu Macro
' Macro recorded 4/08/2005 by Tubby
'

'
Sheets("Sheet1").Select
ActiveWindow.SmallScroll Down:=27
Selection.AutoFilter Field:=1, Criteria1:="Plumber"
Range("B41:B42,D41:D42").Select
Range("D41").Activate
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("B41:B42,D41:D42")
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
ActiveSheet.Shapes("Chart 25").IncrementLeft -165#
ActiveSheet.Shapes("Chart 25").IncrementTop -399.75
Windows("Rental Maintenance.xls").SmallScroll Down:=21
ActiveWindow.Visible = False
Windows("Rental Maintenance.xls").Activate
Selection.AutoFilter Field:=1
End Sub


--
Bilbotubbins
------------------------------------------------------------------------
Bilbotubbins's Profile:
http://www.excelforum.com/member.php...o&userid=25910
View this thread: http://www.excelforum.com/showthread...hreadid=392861





Reply
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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
Marco to run every day at 12 bris Excel Programming 6 March 3rd 04 01:07 PM


All times are GMT +1. The time now is 07:04 AM.

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

About Us

"It's about Microsoft Excel"