LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Need Excel macro to turn off AutoFormat in a table

Hi Jeremy,

You need to reference the table in the worksheet not just the worksheet.
The "If/End If " is not required if you simply want to ensure AutoFilter is
Off.

Example 1:
Sub TablesAndAutoFilter()

Dim ws As Worksheet
Dim objList As ListObject

Set ws = ActiveWorkbook.Worksheets("Sheet1")

Set objList = ws.ListObjects("Table2")

If objList.ShowAutoFilter Then 'Omitted if simply turning off
objList.ShowAutoFilter = False
End If 'Omitted if simply turning off

End Sub


Example 2:
Without assigning to variables and simply ensuring that autofilter is off.

ActiveWorkbook.Worksheets("Sheet1") _
.ListObjects("Table2") _
.ShowAutoFilter = False


--
Regards,

OssieMac


 
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
macro to turn pivot table field on and off S Himmelrich Excel Programming 1 January 21st 09 08:51 PM
How do I turn off the autoformat that converts 1-0 to Jan-00? Josh Excel Discussion (Misc queries) 3 June 3rd 06 01:45 PM
Can I "customize" an autoformat report for a Pivot Table in Excel Nancy Excel Discussion (Misc queries) 1 April 6th 06 01:58 AM
How do I turn off autoformat for .CSV (comma delimited) files? Mike Schwartz Excel Discussion (Misc queries) 1 February 2nd 06 09:08 PM
How do I turn off ALL autoformat in Excel ? (I can't even type "J. Dave a.k.a. Technophobe Excel Worksheet Functions 2 February 23rd 05 01:46 AM


All times are GMT +1. The time now is 07:00 PM.

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"